Should a player script be in ServerScriptService?

Hey everyone!
So, I have this game, where every 60 seconds (1 Minute), The player size increases by 1.
Currently, my script is in ServerScriptService.
My question is: Does a script apply to all the players on the server (I mean, do they all have the same size no matter when they joined), Or is there a different size for each player?

Here is my script:

game.Players.PlayerAdded:Connect(function(player)
	local size = 1 -- This
	player.CharacterAdded:Connect(function(Character)
		local Humanoid = player.Character.Humanoid
		Humanoid.BodyDepthScale.Value = size
		Humanoid.BodyHeightScale.Value = size
		Humanoid.BodyProportionScale.Value = size
		Humanoid.BodyTypeScale.Value = size
		Humanoid.BodyWidthScale.Value = size
		Humanoid.HeadScale.Value = size
		Humanoid.WalkSpeed = 16
		for x = (size+1), 999999, 1 do --For loop where x + 1 each time the loop runs
			wait(60)
			size = tonumber(x)
			print(x) --Print in output
			Humanoid.BodyDepthScale.Value = tonumber(x) --Changing the values to x
			Humanoid.BodyHeightScale.Value = tonumber(x)
			Humanoid.BodyProportionScale.Value = tonumber(x)
			Humanoid.BodyTypeScale.Value = tonumber(x)
			Humanoid.BodyWidthScale.Value = tonumber(x)
			Humanoid.HeadScale.Value = tonumber(x)
			Humanoid.WalkSpeed = 16 + x*2
			Humanoid.JumpPower = 50 + x*2
			for v=1, 3 do
				if Humanoid.Health <= 0 then
					return
				end
				wait(1)
			end
		end
	end)
end)

No, the player will be normal at first when they join according to your script. If you want the changes to be replicated to all the clients then you’d have to do so their character’s changes replicate to everybody.

Example: Make the changes to a NumberValue, and listen for changes for the NumberValue, and change the player’s character’s size to the NumberValue’s value.

Also, you can do a while task.wait(60) loop instead of the for loop as it will end some time.

Also change your wait() to task.wait() since wait() is going to get deprecated soon. Use the new task library!

The PlayerAdded event will be fired each time a player instance is added (each time a user joins the game), the CharacterAdded event will be fired each time a character model is added for any one of those player instances. Consequently, each player’s character’s size will be different (unless their characters were added/created at the same time).

What function do you believe is best to use out these you mentioned?

Both of them are already being used in the script you provided.

1 Like