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

How to easily move all parts of a character on the server?

I've made a bed that lays the player down on it after a keypress, and anchors the humanoid's rootpart, but the issue is that whenever I move the rootpart, the server does not move the rest of the character with it.

The client appears to lay down without any issues, but the server has not acknowledged the parts attached to the rootpart, making the character on the server appear to float. The rootpart has moved, but just not the rest. What can I do to fix this?

If you need it, here's my server script code:

local function onBed(player, bed, char)
	local animation = Instance.new("Animation")
	animation.AnimationId = "http://www.roblox.com/asset/?id=03568388195"
	local animationTrack = char.Humanoid:LoadAnimation(animation)
	char.Humanoid.RootPart.Anchored = true 
	animationTrack:Play()
	char.Humanoid.RootPart.Position = bed.Position + Vector3.new(0, 2, 0)
	char.Humanoid.RootPart.Orientation = bed.Orientation
end

1 comment

0

Use the RootPart's CFrame.

1 answer

✓ Accepted answer

You can use SetPrimaryPartCFrame, which moves all parts of a model, if the model has a primary part.

local function onBed(player, bed, char)
	local animation = Instance.new("Animation")
	animation.AnimationId = "http://www.roblox.com/asset/?id=03568388195"
	local animationTrack = char.Humanoid:LoadAnimation(animation)
	char.HumanoidRootPart.Anchored = true
	animationTrack:Play()
	char:SetPrimaryPartCFrame(bed.CFrame +  CFrame.new(0, 2, 0))
end

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