This isnt changing the size for some reason im so confused
wait(10) function join(plr) lr = plr.Name end while true do wait(0.1) game.Players:WaitForChild(lr).Character.Humanoid.BodyHeightScale.Value = game.Players:WaitForChild(lr).leaderstats.Size.Value game.Players:WaitForChild(lr).Character.Humanoid.BodyWidthScale.Value = game.Players:WaitForChild(lr).leaderstats.Size.Value game.Players:WaitForChild(lr).Character.Humanoid.BodyDepthScale.Value = game.Players:WaitForChild(lr).leaderstats.Size.Value game.Players:WaitForChild(lr).Character.Humanoid.HeadScale.Value = game.Players:WaitForChild(lr).leaderstats.Size.Value end game.Players.PlayerAdded:Connect(join)
The problem with your script above was that you were setting the lr value to a new player each time someone joined. It also isn't very good to have a while loop with only a tenth of a second delay. Here's what I'd recommend. You can start with the player added event which you already have.
game.Players.PlayerAdded:Connect(function() end)
Then we can add a CharacterAdded event that fires everytime someone spawns in instead of every 0.1 seconds.
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) end) end)
And finally, we can add the code to modify the player's character.
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) local humanoid = char:FindFirstChild("Humanoid") local size = plr.leaderstats.Size.Value if humanoid then humanoid.BodyHeightScale.Value = size humanoid.BodyWidthScale.Value = size humanoid.BodyDepthtScale.Value = size humanoid.HeadScale.Value = size end end) end)
If you want the size to update whenever the values do then you can add a Changed event.
function updateSize(plr) -- Putting this just makes it so we don't have to write the same code twice. We can just define it in a function and call it whenever we need. local char = plr.Character if char then local humanoid = char:FindFirstChild("Humanoid") local size = plr.leaderstats.Size.Value if humanoid and size then humanoid.BodyHeightScale.Value = size humanoid.BodyWidthScale.Value = size humanoid.BodyDepthtScale.Value = size humanoid.HeadScale.Value = size end end end game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) updateSize(plr) end) plr:WaitForChild("leaderstats").Size.Changed:Connect(function() updateSize(plr) end) end)
If you have any questions I'd be happy to answer them.