What I'm trying to make is a part following the player and rotating with the player. The part follows the player's torso. I ran into an issue right away, BodyGyro won't do anything no matter what I do..

game.Players.PlayerAdded:connect(function(player)
	local ID = player.UserId .. "'s Part"
	local player = game.Workspace:WaitForChild(player.Name)
	wait()
	local dankness = script.Parent:Clone()
	dankness.Name = ID
	dankness.Parent = game.Workspace
	local bGyro = Instance.new('BodyGyro',dankness)
	bGyro.P = 100000
	local bPosition = Instance.new('BodyPosition',dankness)
	bPosition.P = 10000
	bPosition.MaxForce = Vector3.new(5000000,5000000,5000000)
	dankness.Anchored = false
	dankness.CanCollide = false
	local dead = false
	player.Humanoid.Died:connect(function()
		dead = true
	end)
	while true do
		local part = game.Workspace:WaitForChild(ID)
		while not dead do
			wait(0.2)
			local X = player.Torso.Rotation.X/57.29577
			local Y = player.Torso.Rotation.Y/57.29577
			local Z = player.Torso.Rotation.Z/57.29577
			bGyro.CFrame = CFrame.Angles(X,Y,Z) -- This isn't rotating or doing anything.
			bPosition.Position = player.Torso.Position
		end
		local player = game.Workspace:WaitForChild(player.Name)
	end
end)

Any info is appreciated :)

2 comments

0

Have you tried CFrame.new()*CFrame.Angles(X, Y, Z) instead of just the angles?

0

as far as I see it, the code is working perfectly, can you describe to me the cause of this error?