I have this script that will help me test if I can freeze players in objects. But it doesn't work because of the error:
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) local MoveTo = game.Workspace.MoveTo char:MoveTo(MoveTo.Position) end) end)
In my output, I get:
15:46:19.201 - Workspace.Script:4: attempt to index local 'MoveTo' (a function value)
15:46:19.202 - Stack Begin
15:46:19.203 - Script 'Workspace.Script', Line 4.
15:46:19.203 - Stack End
I have not experienced these kind of errors. Could anyone help me debug this script? Thanks!
hi names are not unique
What does it mean by 'indexing a function value'?
As you know, :MoveTo
is a function, for both humanoids and models.
What :MoveTo
does is it moves models to the desired position, but if used in a humanoid, the humanoid walks to the position instead of just teleporting into it.
Now, that has nothing to do about the error, except for the MoveTo
is a function part.
So, MoveTo
is a function, what now?
The script thinks you're referencing the function, instead of the instance!
There are indexing priorities, which are very important in scripting, and methods are prioritzed more than instances, so it found MoveTo
as a function first.
So an easy way to fix this error is by renaming the part instead!
I am not an expert, but
game.Workspace.MoveTo
? It appears that it thinks MoveTo is a part name(again I'm not an expert, but I'm just trying to help)