Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script doesn't error, but doesn't update player count? [answered]

-- [[ Services ]] --
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")

-- [[ Variables ]] --
local PlayerCountTracker = Workspace:WaitForChild("PlayerNumber")
local PlayerAmount = PlayerCountTracker.Value

-- [[ Functions ]] --
local function increment()
	
	PlayerAmount = PlayerAmount + 1
	
end

local function decrement()
	
	PlayerAmount = PlayerAmount - 1
	
end

-- [[ Events ]] --
Players.PlayerAdded:Connect(increment)
Players.PlayerRemoving:Connect(decrement)

The script does not error, but when I join the game in Studio, the PlayerCount doesn't work. Any help will be appreciated!

3 comments

0

Is this in a script?

0

yes.

0

you cant do that in studio, actually play your game, then it should work

1 answer

Nevermind, I had to play the game in the normal roblox application, not studio.

This discussion is preserved as it was. New answers, comments, and votes are closed.