Hi everyone I’m currently working on an Round Playing Bla Bla System and rn I want the Winners to get their reward which is 250 Cash the Winner could be the Innocents or the Murderer and rn if the Murderer wins he’s the only one that gets the Cash but when the Innocents win the Innocents and the Murderer get the Money and I don’t want the Murderer to get extra Money(Ima paste the Script here which is located in the ServerScriptService):
--The Issue is at the End this line I think I'm not sure: awardCash(playing, 250)
local intermission = 50
local roundLength = 180
local inRound = game.ReplicatedStorage.InRound
local staus = game.ReplicatedStorage.Status
local playingTeam = game.Teams.Playing
local lobbyTeam = game.Teams.Lobby
local murderMysteryModule = require(game.ReplicatedStorage.MurderMysterySystem)
inRound.Changed:Connect(function()
if inRound.Value == true then
for i, plr in pairs(game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitForChild("HumanoidRootPart")
plr.Team = playingTeam
char:WaitForChild("Humanoid").Died:Connect(function()
plr.Team = lobbyTeam
end)
end
else
for i, plr in pairs(game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitForChild("HumanoidRootPart")
local human = char:WaitForChild("Humanoid")
humanRoot.CFrame = game.Workspace.lobbySpawn.CFrame
plr.Team = lobbyTeam
human:UnequipTools()
plr.Backpack:ClearAllChildren()
end
end
end)
local function awardCash(players, amount)
for _, plr in pairs(players) do
if plr and plr:FindFirstChild("leaderstats") and plr.leaderstats:FindFirstChild("Cash") then
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + amount
end
end
end
local function round()
while true do
local requiredPlayers = 2
repeat
wait(1)
staus.Value = "At least " .. requiredPlayers .. " players are needed to start a round"
until #game.Players:GetChildren() >= requiredPlayers
inRound.Value = false
for i = intermission, 0, -1 do
staus.Value = "Game will start in " .. i .. " seconds"
wait(1)
end
inRound.Value = true
local msg = murderMysteryModule.ChooseRoles()
for i = roundLength, 0, -1 do
staus.Value = "Game will end in " .. i .. " seconds"
local playing = {}
for i, plr in pairs(game.Players:GetChildren()) do
if plr.Team.Name == "Playing" then
table.insert(playing, plr)
end
end
local MurdererAlive = false
local NonMurdererAlive = false
local murderer
for _, playerInRound in pairs(playing) do
local role = playerInRound:WaitForChild("Role").Value
if role == "Murderer" then
MurdererAlive = true
murderer = playerInRound
elseif role == "Innocent" then
NonMurdererAlive = true
end
end
if #playing == 0 then
staus.Value = "Everyone Has Died"
wait(3)
break
end
if MurdererAlive and not NonMurdererAlive then
staus.Value = murderer.Name .. " The Murderer Has Won!"
awardCash({murderer}, 250)
wait(3)
break
end
if (not MurdererAlive and NonMurdererAlive) or (NonMurdererAlive and i == 0) then
staus.Value = "The Innocents Have Won!"
awardCash(playing, 250)
wait(3)
break
end
wait(1)
end
wait(3)
end
end
spawn(round)