Log in to vote

Int Value adding not working when a player is being added. HELP?

Asked by 5 months ago
    game.Workspace.Value.Value = game.Workspace.Value.Value + 1

This script is supposed to add 1 to in value if a person join but it doesnt work. Any help will be appreciated!

Are there any errors in console? virushunter9 514 — 5mo

1 answer

Log in to vote
Answered by 5 months ago
Edited 5 months ago

Well first of all, if you are trying to get the amount of players in a game, just do


This will return an array of every player in the game when that is called, so if you want how many people, just add # in front like this

#game.Players:GetChildren() — This will return a number

As for your code, there isn’t much i can do, since it appears to be correct to me, so just check to make sure that that script is in ServerScriptService, and check for spelling, and make sure it actually exists, also you did not tell us what was not working about it, were there any errors?

But I would not reccomend using that to count players, use the method I showed you. Your method is bad practice and may not function as intended.

Also the PlayerAdded event has a parameter, which is the player that joined. Here is an example:


That will print the players name whenever they join.

I hope this helps.

I would recommend :GetPlayers() function instead. yuni_Boy1234 320 — 5mo
Yeah that’s what I meant lol iamtryingtofindname 22 — 5mo

Answer this question