if you want the player to teleport to a part, they player needs to input a Vector3 Value or the name of the part that they want to teleport to. is this what you want?
1 Like
local Player = game.Players.LocalPlayer
local Root = Player.Character:WaitForChild('HumanoidRootPart')
local Click1 = script.Parent:WaitForChild('Click1')
local Box = script.Parent:WaitForChild('Box')
local Selected = script.Parent.Selected
function teleport()
if Player and Player.Character then
Selected.Value = Box.Text
if Selected.Value ~= nil then
Root.Position = workspace[Selected.Value]
end
end
end
Click1.MouseButton1Click:Connect(function()
teleport()
end)
What seems to be the issue here? also, i dont see why you would need an intvalue when teleporting to a specific part
local Player = game.Players.LocalPlayer
local Root = Player.Character:WaitForChild('HumanoidRootPart')
local Click1 = script.Parent:WaitForChild('Click1')
local Box = script.Parent:WaitForChild('Box')
function teleport()
if Player and Player.Character then
if Box.Text ~= nil then
if workspace:FindFirstChild(Box.Text) ~= nil then
Root.CFrame = workspace:FindFirstChild(Box.Text).CFrame
Box.Text = ""
end
end
end
end
Click1.MouseButton1Click:Connect(function()
teleport()
end)
