I tried to convert GuestCapone’s head and arm follow into a server script. It worked out fine until i decided I should test what will happen after the player dies, and this weird bug came out in which infinite possible yield warnings on “workspace.Character.Neck” keep popping out from the console. Currently I have tried many methods but they all have no use. Script is below
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local i = 0
local NeckC0
local NeckC1
game.ReplicatedStorage.Events.tiltChar.OnServerEvent:Connect(function(plr,cf)
local CF = cf
local torso = char:WaitForChild("Torso")
local Neck = torso:WaitForChild("Neck")
local LeftShoulder = torso:WaitForChild("Left Shoulder")
local RightShoulder = torso:WaitForChild("Right Shoulder")
local Humanoid = char:WaitForChild("Humanoid")
local riseMagnitude = 0.9
local RC1 = CFrame.new(1, .5, 0, 0, 0, riseMagnitude, 0, riseMagnitude, 0, -riseMagnitude, 0, 0)
local LC1 = CFrame.new(-1, .5, 0, 0, 0, -riseMagnitude, 0, riseMagnitude, 0, riseMagnitude, 0, 0)
if i == 0 then
NeckC0 = Neck.C0
NeckC1 = Neck.C1
i = 1
end
local offset = CFrame.Angles(0,0,cf.lookVector.Y)
local tool = char:FindFirstChildOfClass("Tool")
if tool then
RightShoulder.C0 = RC1 * offset
LeftShoulder.C0 = LC1 * offset:inverse()
Weapon.C0 = CFrame.Angles(CF.lookVector.y,0,0)
else
RightShoulder.C0 = RC1 * CFrame.Angles(0,0,0)
LeftShoulder.C0 = LC1 * CFrame.Angles(0,0,0)
end
Neck.C0 = NeckC0 * CFrame.Angles(CF.lookVector.y, 0, 0):inverse()
end)
end)
end)
The tilt char event is fired through runservice.RenderStepped
edit1: