I used a code that move model that i named 'ladder'
Part = script.Parent Model = game.Workspace:WaitForChild("Ladder") Part.ClickDetector.MouseClick:connect(function() Ladder:MoveTo(Vector3.new(177.331, 22.626, 100.366)) end)
This is the code, but i get
Workspace.Part.Script:5: attempt to index global 'Ladder' (a nil value)
error, so what is the problem?
Your error occured because you set the variable name of your ladder to Model in line 2, but you tried to call it as Ladder in line 5.
Also, it is better to use local variables as they can be accessed faster than non-local variables.
local Part = script.Parent local Model = game.Workspace:WaitForChild("Ladder") Part.ClickDetector.MouseClick:Connect(function() Model:MoveTo(Vector3.new(177.331, 22.626, 100.366)) end)