In the game I’m making, I wanted to create a powerup that would randomly give certain effects to the player that collected it. One of these effects would shrink the player while also making them run faster. However, it appears changing the body scales is breaking player replication. The player that collected the powerup would see themselves moving as normal, but the server and other clients would see that player running in place. One oddity I noticed is that despite the server also seeing the shrunken player stuck in place, they would still be able to pick up other power ups even though pickups rely on part Touched events in scripts on the server.
Replication also immediately resumes as normal when the player is returned to regular size.
What the player would see: (note that when I place and kick a bomb it happens at the position where I picked up the powerup and not at the player)
What the server and other clients would see:
The code that changes the players size (located in a script parented to the player’s HumanoidRootPart)
local playerVal = script:FindFirstChild("Player") --the script has an ObjectValue child referring to the affected player
local hum = playerVal.Value.Character.Humanoid
local regheadscale = 1
local regbodydepth = 1
local regbodywidth = .75
local regbodyheight = .75;
local smallheadscale = .5
local smallbodydepth = .5
local smallbodywidth = .375
local smallbodyheight = .375;
hum.HeadScale.Value = smallheadscale;
hum.BodyDepthScale.Value = smallbodydepth;
hum.BodyHeightScale.Value = smallbodyheight;
hum.BodyWidthScale.Value = smallbodywidth;
hum.WalkSpeed = 22;
game:GetService("ServerStorage").BindableEvents.EndPoison.Event:Connect(function(player,forced)
--this event connection can be ignored in this case, just forces the effects to end early when fired
if player == playerVal.Value then
hum.HeadScale.Value = regheadscale;
hum.BodyDepthScale.Value = regbodydepth;
hum.BodyHeightScale.Value = regbodyheight;
hum.BodyWidthScale.Value = regbodywidth;
hum.WalkSpeed = 16;
game:GetService("ServerStorage").BindableEvents.PoisonEnded:Fire(false)
script:Destroy();
end
end)
wait(20) --the effect ends after 20 seconds
hum.HeadScale.Value = regheadscale;
hum.BodyDepthScale.Value = regbodydepth;
hum.BodyHeightScale.Value = regbodyheight;
hum.BodyWidthScale.Value = regbodywidth;
hum.WalkSpeed = 16;
script:Destroy();
I narrowed down the issue strictly to shrinking the player. Commenting out the walkspeed changes doesn’t fix it, but commenting out the bodyscale changes does. Naturally, commenting out everything also doesn’t result in broken replication.