Issue with teleport button on screen

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)

Heres error:
Screenshot_154

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.

2 Likes

Try this:

local char = Player.CharacterAdded:Wait()

1 Like

ye it work! Thanks!

Tryed so many ways and finally decide to post it in devforum :smiley:

2 Likes