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

Why is bodyposition not working?

Asked by 8 years ago

Here is the script that I am wanting to use to move a part to a destination. I went off of youtube for help with this. Also the script is in ServerScriptServer for now. (I edited and changed the script because I took a recommendation however it is still not working)

Line =  game.Workspace.Line
Hook = game.Workspace.Hook
BodyPosition = BodyPosition.Parent

do
    BodyPosition.Position = Hook.Position
end

Also here is the output for the script-

1:25:26.473 - Auto-Saving...
Hello world!
21:25:28.650 - Workspace.Script:3: attempt to index global 'BodyPosition' (a nil value)
21:25:28.651 - Stack Begin
21:25:28.652 - Script 'Workspace.Script', Line 3
21:25:28.653 - Stack End
21:25:28.912 - Players:GetNameFromUserId() failed because HTTP 400 (HTTP/1.1 400 Invalid userId)
21:25:28.913 - Script 'Workspace.MakerModelLua's Admin.MakerModelLua's Admin Anti-Exploit Module', Line 3
21:25:28.914 - Stack End
21:25:29.925 - An error occurred
21:25:29.927 - Script 'Workspace.MakerModelLua's Admin', Line 504
21:25:29.928 - Stack End

I have inserted BodyPosition into the part, Line.

0
Just a mental note for me later. (pay no attention) BodyPosition.Position = Hook.Position sammy52520 45 — 8y

1 answer

Log in to vote
0
Answered by
Cuvette 246 Moderation Voter
8 years ago

Here's how I move parts around, this is part of a script I made.

positionnew = script.Parent.CFrame.y
getx = script.Parent.CFrame.x
getz = script.Parent.CFrame.z

Then in a while loop you could use the following

script.Parent.CFrame = CFrame.new(getx,positionnew,getz)

For example

positionnew = script.Parent.CFrame.y
getx = script.Parent.CFrame.x
getz = script.Parent.CFrame.z

while true do
    script.Parent.CFrame = CFrame.new(getx,positionnew,getz)
    wait()
end

The script is inside the part. Although I'm not the best at CFraming in general I hope this helps you in any way.

0
I am looking for a more simple way of completing a motion due to lag. So I am using bodyposition to complete a task because it seems simpler. :) sammy52520 45 — 8y
Ad

Answer this question