Content added Content deleted
(Created page with "{{Object |image1 = LifeSensor.png |type = {{#invoke:GetPartInfo|getField|Type}} |uses = <!-- --> |recipe = {{#invoke:GetPartInfo|getField|Recipe}} |raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}} |malleability = {{#invoke:GetPartInfo|getField|Malleability}} |durability = {{#invoke:GetPartInfo|getField|Durability}} |configuration = {{#invoke:GetPartInfo|getField|Configuration}} }} <!-- Some information --> The LifeSensor is a...") |
(Added more info and example script.) |
||
Line 2: | Line 2: | ||
|image1 = LifeSensor.png |
|image1 = LifeSensor.png |
||
|type = {{#invoke:GetPartInfo|getField|Type}} |
|type = {{#invoke:GetPartInfo|getField|Type}} |
||
|uses = |
|uses = Find nearby players |
||
|recipe = {{#invoke:GetPartInfo|getField|Recipe}} |
|recipe = {{#invoke:GetPartInfo|getField|Recipe}} |
||
|raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}} |
|raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}} |
||
Line 12: | Line 12: | ||
<!-- Some information --> |
<!-- Some information --> |
||
The LifeSensor is a part used in programming. It detects life within 2000 studs. Lifesensors are found in all aliens as a way to sense players. |
The LifeSensor is a part used in programming. It detects life within 2000 studs. Lifesensors are found in all aliens as a way to sense players. In order to use, you must use the LifeSensor:GetReading() function. It will return a dictionary of all the nearby players and their locations, given in Vector3.<br> |
||
The script below is an example of a turret that uses a lifesensor. |
|||
<syntaxhighlight lang="lua" line="1"> |
|||
local LifeSensor = GetPartFromPort(1, "LifeSensor") --gets the lifesensor instance |
|||
local gyro = GetPartFromPort(2, "Gyro") --gets the gyro instance |
|||
local whitelist = { |
|||
["YourUsername"] = true; -- Create a whitelist of who it wont target |
|||
["YourFriend"] = true; |
|||
} |
|||
local reading = LifeSensor:GetReading() -- gets the reading of the lifesensor |
|||
for player, location in pairs(reading) do |
|||
if not whitelist[player] then --checks if player isnt whitelisted |
|||
gyro:PointAt(location) -- points the gyro at the location |
|||
end |
|||
end |
|||
</syntaxhighlight> |
|||
<!-- Automated fields --> |
<!-- Automated fields --> |
||
Revision as of 01:03, 24 June 2023
The LifeSensor is a part used in programming. It detects life within 2000 studs. Lifesensors are found in all aliens as a way to sense players. In order to use, you must use the LifeSensor:GetReading() function. It will return a dictionary of all the nearby players and their locations, given in Vector3.
The script below is an example of a turret that uses a lifesensor.
local LifeSensor = GetPartFromPort(1, "LifeSensor") --gets the lifesensor instance
local gyro = GetPartFromPort(2, "Gyro") --gets the gyro instance
local whitelist = {
["YourUsername"] = true; -- Create a whitelist of who it wont target
["YourFriend"] = true;
}
local reading = LifeSensor:GetReading() -- gets the reading of the lifesensor
for player, location in pairs(reading) do
if not whitelist[player] then --checks if player isnt whitelisted
gyro:PointAt(location) -- points the gyro at the location
end
end
In-game Description
"Senses and detects organic life up to a distnace of 2000 studs. Used mainly in programming, as is used in alien technology to hunt down organisms such as players. Has a special programmable event called 'GetReading()' which returns a table of all organisms, with their positions and names. Example: { Player1 = Vector3.new(5, 5, 5); } "
Configuration
- Cannot be configured.