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

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

Asked by 6 years ago

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)

0
You could make all the players jump then teleport them. User#20279 0 — 6y
0
Im looking for more of a "while sitting then false" kind of thing DawsonDelRey -5 — 6y
0
Ah, I see. Give me a minute to make an answer. User#20279 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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
0
this isnt working... DawsonDelRey -5 — 6y
Ad

Answer this question