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

Function for teleport script won't work. Help?

So i'm trying to make a tool where when you activate the tool, it teleports you to where your mouse's cursor is. It's a local script.

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local plrn = plr.Name
local plrchr = game.Workspace:WaitForChild(plr.Name, 10000)

tping = false

script.Parent.Activated:Connect(function()
	mouse.Button1Down:Connect(function()
		if tping == false then
		wait(0.1)
		tping = true
		plrchr.HumanoidRootPart.CFrame = mouse.Hit
		wait(0.25)
		tping = false
		end
	end)
end)

Can someone help me with this?

1 answer

✓ Accepted answer

The script works fine for me when I inserted it into a LocalScript inside of a tool. Make sure the tool has "RequiresHandle" set to false

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