Score system stopped working after publishing game

Hi guys,I’m developing a agame based on roblox CTF template,I had to make a test so I published it,I noticed that the score system doesn’t work anymore in playing mode in studio(when I take the flag and then I take it to mne it doesnt score).I had the same problem with a previous build of that game,I didn’t understand what the problem was,so I remade the game from scratch,now that I published it it stopped working again.What can I do?How can I remove the game from roblox while keeping it on studio?Please help!

Can you provide a minimal, however relevant snippet of your current code?

The maingame script ?Overall I didn’t modified any string from that code

From whichever script responsible for handling the score.

2 Likes

As far as I know there is no option to completely delete a game, what you can do is to set the game to private by clicking on the 3 dots on your game page or inside studio from Home Tab> Settings> Permission> Set private

local GameManager = {}

– ROBLOX services
local Players = game.Players

– Game services
local Configurations = require(game.ServerStorage.Configurations)
local TeamManager = require(script.TeamManager)
local PlayerManager = require(script.PlayerManager)
local MapManager = require(script.MapManager)
local TimeManager = require(script.TimeManager)
local DisplayManager = require(script.DisplayManager)

– Local Variables
local IntermissionRunning = false
local EnoughPlayers = false
local GameRunning = false
local Events = game.ReplicatedStorage.Events
local CaptureFlag = Events.CaptureFlag
local ReturnFlag = Events.ReturnFlag

– Local Functions
function OnCaptureFlag(player)
PlayerManager:AddPlayerScore(player, 1)
TeamManager:AddTeamScore(player.TeamColor, 1)
DisplayManager:DisplayNotification(player.TeamColor, ‘Captured Flag!’)
end

local function OnReturnFlag(flagColor)
DisplayManager:DisplayNotification(flagColor, ‘Flag Returned!’)
end

– Public Functions
function GameManager:Initialize()
MapManager:SaveMap()
end

function GameManager:RunIntermission()
IntermissionRunning = true
TimeManager:StartTimer(Configurations.INTERMISSION_DURATION)
DisplayManager:StartIntermission()
EnoughPlayers = Players.NumPlayers >= Configurations.MIN_PLAYERS
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
spawn(function()
repeat
if EnoughPlayers and Players.NumPlayers < Configurations.MIN_PLAYERS then
EnoughPlayers = false
elseif not EnoughPlayers and Players.NumPlayers >= Configurations.MIN_PLAYERS then
EnoughPlayers = true
end
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
wait(.5)
until IntermissionRunning == false
end)

wait(Configurations.INTERMISSION_DURATION)
IntermissionRunning = false

end

function GameManager:StopIntermission()
–IntermissionRunning = false
DisplayManager:UpdateTimerInfo(false, false)
DisplayManager:StopIntermission()
end

function GameManager:GameReady()
return Players.NumPlayers >= Configurations.MIN_PLAYERS
end

function GameManager:StartRound()
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()

PlayerManager:AllowPlayerSpawn(true)
PlayerManager:LoadPlayers()

GameRunning = true
PlayerManager:SetGameRunning(true)
TimeManager:StartTimer(Configurations.ROUND_DURATION)

end

function GameManager:Update()
–TODO: Add custom custom game code here
end

function GameManager:RoundOver()
local winningTeam = TeamManager:HasTeamWon()
if winningTeam then
DisplayManager:DisplayVictory(winningTeam)
return true
end
if TimeManager:TimerDone() then
if TeamManager:AreTeamsTied() then
DisplayManager:DisplayVictory(‘Tie’)
else
winningTeam = TeamManager:GetWinningTeam()
DisplayManager:DisplayVictory(winningTeam)
end
return true
end
return false
end

function GameManager:RoundCleanup()
PlayerManager:SetGameRunning(false)
wait(Configurations.END_GAME_WAIT)
PlayerManager:AllowPlayerSpawn(false)
PlayerManager:DestroyPlayers()
DisplayManager:DisplayVictory(nil)
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()
TeamManager:ShuffleTeams()
MapManager:ClearMap()
MapManager:LoadMap()

end
This is the game manager script
– Bind Events
CaptureFlag.Event:connect(OnCaptureFlag)
ReturnFlag.Event:connect(OnReturnFlag)

return GameManager

For future reference; you can add code markdown for readability by doing:

```lua
– code
local a = 2 + 4
```

-- code
local a = 2 + 4
2 Likes
– code
local GameManager = {}

– ROBLOX services
local Players = game.Players

– Game services
local Configurations = require(game.ServerStorage.Configurations)
local TeamManager = require(script.TeamManager)
local PlayerManager = require(script.PlayerManager)
local MapManager = require(script.MapManager)
local TimeManager = require(script.TimeManager)
local DisplayManager = require(script.DisplayManager)

– Local Variables
local IntermissionRunning = false
local EnoughPlayers = false
local GameRunning = false
local Events = game.ReplicatedStorage.Events
local CaptureFlag = Events.CaptureFlag
local ReturnFlag = Events.ReturnFlag

– Local Functions
function OnCaptureFlag(player)
PlayerManager:AddPlayerScore(player, 1)
TeamManager:AddTeamScore(player.TeamColor, 1)
DisplayManager:DisplayNotification(player.TeamColor, ‘Captured Flag!’)
end

local function OnReturnFlag(flagColor)
DisplayManager:DisplayNotification(flagColor, ‘Flag Returned!’)
end

– Public Functions
function GameManager:Initialize()
MapManager:SaveMap()
end

function GameManager:RunIntermission()
IntermissionRunning = true
TimeManager:StartTimer(Configurations.INTERMISSION_DURATION)
DisplayManager:StartIntermission()
EnoughPlayers = Players.NumPlayers >= Configurations.MIN_PLAYERS
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
spawn(function()
repeat
if EnoughPlayers and Players.NumPlayers < Configurations.MIN_PLAYERS then
EnoughPlayers = false
elseif not EnoughPlayers and Players.NumPlayers >= Configurations.MIN_PLAYERS then
EnoughPlayers = true
end
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
wait(.5)
until IntermissionRunning == false
end)

wait(Configurations.INTERMISSION_DURATION)
IntermissionRunning = false
end

function GameManager:StopIntermission()
–IntermissionRunning = false
DisplayManager:UpdateTimerInfo(false, false)
DisplayManager:StopIntermission()
end

function GameManager:GameReady()
return Players.NumPlayers >= Configurations.MIN_PLAYERS
end

function GameManager:StartRound()
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()

PlayerManager:AllowPlayerSpawn(true)
PlayerManager:LoadPlayers()

GameRunning = true
PlayerManager:SetGameRunning(true)
TimeManager:StartTimer(Configurations.ROUND_DURATION)
end

function GameManager:Update()
–TODO: Add custom custom game code here
end

function GameManager:RoundOver()
local winningTeam = TeamManager:HasTeamWon()
if winningTeam then
DisplayManager:DisplayVictory(winningTeam)
return true
end
if TimeManager:TimerDone() then
if TeamManager:AreTeamsTied() then
DisplayManager:DisplayVictory(‘Tie’)
else
winningTeam = TeamManager:GetWinningTeam()
DisplayManager:DisplayVictory(winningTeam)
end
return true
end
return false
end

function GameManager:RoundCleanup()
PlayerManager:SetGameRunning(false)
wait(Configurations.END_GAME_WAIT)
PlayerManager:AllowPlayerSpawn(false)
PlayerManager:DestroyPlayers()
DisplayManager:DisplayVictory(nil)
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()
TeamManager:ShuffleTeams()
MapManager:ClearMap()
MapManager:LoadMap()

end
This is the game manager script
– Bind Events
CaptureFlag.Event:connect(OnCaptureFlag)
ReturnFlag.Event:connect(OnReturnFlag)

return GameManager

Better. However, I don’t think this code is related to your issue.

Note: If you didn’t write this code, then it’s much better for both you and us if you try to write your own instead so you do understand what part is specifically doing what.

I actually published that game overwritten at the game that had this problem.But I don’t think this is the problem
UPDATE:I made a test on a other game and overwritting the game to an other onedoesn’t give the problem(I think)

So I just dicovered the problem,it was a simple script that added a cash counter on the laderboard,maybe if I insert a Script that edit the leaderboard GUI (the place where the “captures” indicator was set by default)it makes some sort of mess.This is the money script

– code
game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	
	local cash = Instance.new("NumberValue",leaderstats)
	cash.Name = "Cash"
	cash.Value = 50 -- 50 starting cash
end)
1 Like