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

Making PLAYER Teleport To A Certain Seat?

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

✓ Accepted answer

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!

3 comments

0

Thx!

0

Np :D

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

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