Im writing some code to make the players arm follow the camera.I already have this code that seems like it should be working to me, but when I try to change the transform of a player’s shoulder nothing happens…
Local script in tool
--sends camera cframe to server
game:GetService("RunService").Stepped:Connect(function()--make sure to use stepped instead of render stepped!
events.SendClientInfo:FireServer(camera.CFrame)
end)
Server script in tool
--receives cframe and resends to all clients
events.SendClientInfo.OnServerEvent:Connect(function(player, cameraCF)
game.ReplicatedStorage.Events.CharacterReplication.Tool:FireAllClients(player, cameraCF)
end)
Local script in starter character scripts (maybe should be in starter player scripts?)
--moves cframes
replicationEvents.Tool.OnClientEvent:Connect(function(targetPlayer:Player, cameraCF)
local rotationX, rotationY, rotationZ = cameraCF.Rotation:ToOrientation()
--if I print rotationX, it prints the right number. So the issue is not with sending the info between scripts
local rightShoulder:Motor6D = targetPlayer.Character.RightUpperArm.RightShoulder
rightShoulder.Transform *= CFrame.Angles(rotationX, 0, 0) --certain the issue is here. It moves (in the wrong way) if I change it to C1 or C0
end)
The code works if I keep it in the original client, but stops working if I try this replication method. The only things I could think that are an issue is maaaybe the second client script being in character scripts when it should be in player scripts (Which I haven’t tried yet I just thought of it) or maybe something to do with workspace.Retargeting? Idk I just heard of it looking for a solution. Other than that Im certain it has to do with the transform property.