Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i fix this attempt to index field 'move' (a function value) error?

Asked by 5 years ago

attempt to index field 'move' (a function value)

local pos = game.Workspace.move.Position
while true do 
    wait()
    script.Parent.Humanoid:MoveTo(pos)
end

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
5 years ago
Edited 5 years ago

The MoveTo method needs to be invoked on a model, not a humanoid or anything else, so just go one level higher and use script.Parent

local pos = game.Workspace.move.Position
while true do 
    wait()
    script.Parent.Humanoid:MoveTo(pos)--humanoid isnt a model so it doesnt work
end
0
wait so i have to move modle? helleric -3 — 5y
0
yup, isnt the entire robloxian what you wanted to move?, anyway here is the wiki for the moveto method, there is a useful argument inside it : https://www.robloxdev.com/api-reference/function/Model/MoveTo aazkao 787 — 5y
0
yeah helleric -3 — 5y
0
Make sure to declare which is the primarypart by using this,model.PrimaryPart = (whatever part you want it to base the position on) aazkao 787 — 5y
Ad

Answer this question