Hi,
Im making teleport button and i made script but when i testing its getting error
Please say what i should change to make it work
Heres script:
local Player = game.Players.LocalPlayer
local char = Player.Character
local torso = char:FindFirstChild("Torso")
local tpLocation = game.Workspace.Pads:GetChildren(script.Parent.Parent.Name)
script.Parent.MouseButton1Click:Connect(function()
char.Torso.CFrame = CFrame.new(tpLocation.Position)
end)
Instead of calling local tpLocation = game.Workspace.Pads:GetChildren(script.Parent.Parent.Name) you have to call it like: local tpLocation = game.Workspace.Pads:FindFirstChild(script.Parent.Parent.Name) because of GetChildren() function is going to return you array containing Instance’s children.