Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Teleportation script problem, Cars teleport with users when they teleport, fixable?

I am making a game and there are CLICK to teleport scripts in it. When they are in their vehicles if they click the teleporter the car teleports with them.

Is there a way to configure this script so that while they're sitting they do not teleport?


function onClicked()

local c = game.Players:GetChildren() 
for i = 1, #c do 
c[i].Character.Torso.CFrame = CFrame.new(script.Parent.Parent.Teleport.Position) 
end 

end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

3 comments

0

You could make all the players jump then teleport them.

0

Im looking for more of a "while sitting then false" kind of thing

0

Ah, I see. Give me a minute to make an answer.

1 answer

If you don't want players teleporting when they're sitting, you can simply use a conditional statement and the Sit property in the humanoid to do this.

Example :

for i,v in pairs(game.Players:GetPlayers()) do
	if v.Character.Humanoid.Sit == false then
		--Code here
	end
end

1 comment

0

this isnt working...

This discussion is preserved as it was. New answers, comments, and votes are closed.