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

My gui Teleportation button isn't working? Please help :C

I've been trying to make this script work for a nice amount of time but I wasn't having any luck.

Button.Name = "Button"
Button.Parent = Base
Button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Button.BackgroundTransparency = 0.900
Button.Position = UDim2.new(0.0368663594, 0, 0.284482747, 0)
Button.Size = UDim2.new(0, 200, 0, 50)
Button.Font = Enum.Font.Cartoon
Button.Text = "Tp To Your Base"
Button.TextColor3 = Color3.fromRGB(0, 0, 0)
Button.TextScaled = true
Button.TextSize = 14.000
Button.TextWrapped = true
Button.MouseButton1Down:Connect(function()
local player = game.Players.LocalPlayer
local character = player.Character
	if not character or not character.Parent then
	character = player.CharacterAdded:wait()
end
local hum = character:WaitForChild("Humanoid")
 
script.Parent.MouseButton1Down:Connect(function()
	character:WaitForChild("HumanoidRootPart").Position = Vector3.new(623.33, 242.52, 213)
end)

end)

1 answer

✓ Accepted answer

You have to use Model:MoveTo().

Button.Name = "Button"
Button.Parent = Base
Button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Button.BackgroundTransparency = 0.900
Button.Position = UDim2.new(0.0368663594, 0, 0.284482747, 0)
Button.Size = UDim2.new(0, 200, 0, 50)
Button.Font = Enum.Font.Cartoon
Button.Text = "Tp To Your Base"
Button.TextColor3 = Color3.fromRGB(0, 0, 0)
Button.TextScaled = true
Button.TextSize = 14.000
Button.TextWrapped = true
Button.MouseButton1Down:Connect(function()

local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

script.Parent.MouseButton1Down:Connect(function()
	character:MoveTo()
end)

end)

3 comments

0

Also you dont need an remote event since we are not refrencing the local player but if you want to use it then its okay

0

I think you'd need it since teleporting a character is too much of a job for a LocalScript.

0

nvm i fixed it

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