I’ve ran into this issue where my code works in play solo and a test server (2 players) but, magically doesn’t work ingame. Not a single error or warning occurs and I have no idea why.
I know that it’s an error happening server side since the client works just fine.
Here’s roughly what my code looks like:
-- Server Script
bindEvent("loanGunToCharacter",function(player,name)
local w = WeaponsFolder:FindFirstChild(name):Clone()
w.Parent = game.Workspace:WaitForChild(tostring(player.UserId)).ViewportCharacter
if currentGunMappings[player.UserId] then
table.insert(currentGunMappings,player.UserId,name)
return
end
table.insert(currentGunMappings,player.UserId,name)
end)
bindEvent("updatePlayerBody",function(player,data)
if playersData[player.UserId] then
table.insert(playersData,player.UserId,{name=player.Name,info=data})
return
end
table.insert(playersData,player.UserId,{name=player.Name,info=data})
end)
-- Update every player movement
RunService.Heartbeat:Connect(function(step)
if #playersData <= 0 then
repeat wait() until #playersData > 0
warn("Should be fine now")
return
end
for i,v in pairs(Players:GetPlayers()) do
local Character = v.Character
--print("Character : ",Character)
local success,err = pcall(function() -- bro what
-- preload data
Character["LeftUpperArm"]["LeftShoulder"].C0 = playersData[v.UserId]["info"]["LeftShoulder"]
Character["RightUpperArm"]["RightShoulder"].C0 = playersData[v.UserId]["info"]["RightShoulder"]
Character["LeftLowerArm"]["LeftElbow"].C0 = playersData[v.UserId]["info"]["LeftElbow"]
Character["RightLowerArm"]["RightElbow"].C0 = playersData[v.UserId]["info"]["RightElbow"]
end)
if not success then
warn("bruhhh")
end
end
end)
-- Local Script
function sendCharacterMovementUpdate()
local data = {
["LeftShoulder"] = Character["LeftUpperArm"]["LeftShoulder"].C0,
["RightShoulder"] = Character["RightUpperArm"]["RightShoulder"].C0,
["LeftElbow"] = Character["LeftLowerArm"]["LeftElbow"].C0,
["RightElbow"] = Character["RightLowerArm"]["RightElbow"].C0,
["WeaponCFrame"] = Character:WaitForChild(PrimaryGun):GetPrimaryPartCFrame()
}
remotesFolder:WaitForChild("updatePlayerBody"):FireServer(data)
data = {}
end
RunService.Heartbeat:Connect(sendCharacterMovementUpdate)
It’s supposed to mirror the Motor6D cframes from client to server. This way any changes made locally can be seen by everyone on the server. Unfortunately, only changes take place on the client whereas any other character has no changes made.
I’m absolutely stumped on how to fix this and I greatly appreciate any responses.