Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago
-- [[ 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!

0
Is this in a script? zandefear4 90 — 4y
0
yes. Kataclysmix 23 — 4y
0
you cant do that in studio, actually play your game, then it should work matiss112233 258 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question