Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can Somebody help me? Please anyone, Pleeeaaassseee D;

Asked by
ImfaoXD 158
8 years ago

Can somebody help me? I'm trying to figure out where I can check to see if there is a robloxian in my cars! I don't want my cars being respawned while someone sits in them, but I still want them to respawn if someone isn't in them! Help! :(

local RespawnCarsBlock=game.Workspace.RespawnCarsBlock
local Car=game.ServerStorage.Car

function RespawnCars()
print ("R3sp@wN c@rz n0w pl0x.")
for _,object in pairs (game.Workspace:GetChildren())do

if object.Name=="Car"
then 
print ("IT'S A CAR! KILL THE INFERIOR BEING!")
object:Destroy()
end
end
for _, object in pairs (game.ServerStorage:GetChildren())do

local CarCopy= object:Clone()
CarCopy.Parent=game.Workspace
CarCopy:MakeJoints()
end





end



RespawnCarsBlock.Touched:connect(RespawnCars)

2
VehicleSeats have a property called Occupant. Just check if that's nil. http://wiki.roblox.com/index.php?title=API:Class/VehicleSeat/Occupant Pyrondon 2089 — 8y
1
That is a very hard script to read... try using an 'if' statement Avectus 120 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

ROBLOX players can be found inside of cars, and to check them you can use the simple magnitude magic trick!


local carpart = workspace.CARMODEL.PARTNAME local plr = game.Players.PLAYERNAME local char = plr.Character.Torso if (carpart.Position - char.Position).magnitude < 3 then print("Boop") else return end
1
I would have used < 4 but wutever. Avectus 120 — 8y
Ad

Answer this question