Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is bodyposition not working?

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.

1 comment

0

Just a mental note for me later. (pay no attention) BodyPosition.Position = Hook.Position

1 answer

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.

1 comment

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. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.