Hey So I've been Attempting to Make a teleport script, (tool)
local cooldown = false repeat wait() until game.Players.LocalPlayer.Character local plr = game.Players.LocalPlayer local MyBody = plr.Character local mouse = plr:GetMouse() script.Parent.Activated:Connect(function() if not cooldown then cooldown = true local hit = mouse.Hit wait(1) MyBody:MoveTo(hit.p) wait(1) cooldown = false end end)
I need it So when a Player Touches another Player, They Get Teleported wih the Teleporting Player, Thanks
Make two events. A touched event and touch ended event. Make a list in the beginning of the script to store the players currently touching the current player. Under the touched function, check to make sure that a player is touching them, and add their name to the list. Do the opposite for the touchended, if it's a player, remove their name from the list. If you were to set this event to all the body parts it may be hard to tell when they stop touching one part of the character but are still touching another part. So it may be easier to just set the events on only the upper torso. Once the events are established then when it teleports, have it cycle through each player in the list and teleport them as well. Also you may want to execute the move functions in a server script through a remote event as doing it on the client will cause the position of the player only to update on the client side. Everyone else in the server won't see you teleport. Hope this helps.