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

Why is my teleport script not being functional?

I've done this kind of script a million times, and they always work. Why is this not working?

local button = script.Parent
local player = game.Players.LocalPlayer
function tat()
	player.Character.Torso.CFrame = game.Workspace.xgon.CFrame
end
button.ClickDetector.MouseClick:connect(tat)

1 answer

✓ Accepted answer

The Script is impossible.

There are two kinds of Scripts - LocalScripts and regular Scripts. You got two mistake that make correction of this code impossible.

1. Putting LocalPlayer in a Script inside a Part LocalPlayer doesn't work in normal Scripts. You also can't just put a LocalScript in a Part, they only run in specific locations, like the character or the Player's descendants.

2. Messing up with Script Types. As I stated in 1., you can't put LocalPlayer in a Script, denying the usage of a Script, but you also can't put a LocalScript in this kind of button - denying the usage of a LocalScript.

You have to rewrite the whole system for this.

or, you just take a look at this page and you would find out theres a neat argument passed to determine the "LocalPlayer" ;)

1 comment

0

Thanks a lot, man.

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