Hello, I am trying to rotate a part with a hingeConstraint, but there is a problem. The players aren’t synchronized. The player sees himself jumping on the part, but the other players see something different.
This is what the other players see.
I realize that this doesn’t happen to the player that has the network Ownership.
Here is the script I use to set the network ownership
local Players = game:GetService("Players")
local part = script.Parent
local networkOwnershipSet = false
part:SetNetworkOwner(nil) -- set the network ownership to server
local function checkPlayerLeft(player)
Players.PlayerRemoving:Connect(function(player) -- check to see if the player has left the game
networkOwnershipSet = false
part:SetNetworkOwner(nil) -- set network ownership to server
end)
end
part.Touched:Connect(function(Hit)
local humanoid = Hit.Parent:FindFirstChild("Humanoid") -- try to find humanoid
if humanoid and not networkOwnershipSet then -- check to see if network ownership is not set already and part that touched is a player
local player = Players:GetPlayerFromCharacter(humanoid.Parent) -- get the player
part:SetNetworkOwner(player) -- set the network ownership to that player
networkOwnershipSet = true
checkPlayerLeft(player)
end
end)
How could I fix this?
Thanks