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

Whats wrong with this Gui Script?

Im trying to make it where if "On" is clicked it Teleports you to a certain point In Game but right now it is not Working, Any Help?

function click(mouse)
local human = game.Players:GetChildren()
if human then
	local humanoid = human:findFirstChild("Humanoid")
	if humanoid then
		human.Torso.CFrame = CFrame.new(-47.52, 106.53, 40.24)
	end
end
end
script.Parent.MouseButton1Down:connect(click)

1 answer

✓ Accepted answer

human in your code is a Table, not a specific Player. Additionally, the Player's Character is where their physical parts - limbs and the Humanoid - are stored, not the Player itself.

I'm assuming this is a LocalScript:

function click(mouse)
local human = game.Players.LocalPlayer.Character
if human then
    local humanoid = human:findFirstChild("Humanoid")
    if humanoid then
        human.Torso.CFrame = CFrame.new(-47.52, 106.53, 40.24)
    end
end
end
script.Parent.MouseButton1Down:connect(click)

1 comment

0

Thank You!

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