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

Making PLAYER Teleport To A Certain Seat?

Asked by
sammiya1 134
7 years ago
function onTouched(hit)
game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(90, 50, 90))
end
script.Parent.Touched:connect(onTouched) 

Is the script i use but it first wont work and secondly im not even sure how to make it that if it does teleport them to that seat then if someone else tries to then it teleports them to another asvalible seat and not that one till its free. Im kinda new to scripting lvl 0.5. Help please

1 answer

Log in to vote
0
Answered by
guiraz 25
7 years ago

Hey man, that script won't work online either, you need to get the touching player's character so:

local seat_part = game.Workspace.Seat --get the seat

function onTouched(hit)
    if hit.Parent:FindFirstChild("Humanoid") then --check if the part is part of the humanoid's body
        local character = hit.Parent --character (player model on the workspace)
        local humanoid = character:WaitForChild("Humanoid") --humanoid found inside the player's character
        humanoid:MoveTo(seat_part.Position) --function of the humanoid
    end
end

script.Parent.Touched:connect(onTouched) 


humanoid api: http://wiki.roblox.com/index.php?title=API:Class/Humanoid

And thats it, hope Î helped!

0
Thx! sammiya1 134 — 7y
0
Np :D guiraz 25 — 7y
0
hey guiraz are you able to help me with a project? i will pay you robux once its done since the project is a game many robloxians will play and buy gamepasses for. Pm on sammiya1 or here sammiya1 134 — 7y
Ad

Answer this question