So I’m stumped. I’m working on my first minigame type of roblox game, and I’ve worked out all the kinks except the point awarding System. Gonna give an example of my code below
Server Script (inside a while true do loop)
for _, WinningPlayer in pairs(playersInRound) do
if WinningPlayer and onWin then
onWin(WinningPlayer, Points)
end
if WinningPlayer.Character and WinningPlayer.Character:FindFirstChild('Humanoid') then
WinningPlayer.Character:SetPrimaryPartCFrame(CFrame.new(ElevatorTeleport.Position))
WinningPlayer.PlayerGui.SpectateGui.SpectateButton.TextLabel.Text = "SPECTATE"
WinningPlayer.PlayerGui.SpectateGui.Enabled = false
WinningPlayer.PlayerGui.MainPlayerGui.Enabled = true
end
end
Module Script Function
return function(winner, points)
winner:WaitForChild("leaderstats").Points.Value = winner:WaitForChild("leaderstats").Points.Value + points.Value
winner:WaitForChild("leaderstats").Wins.Value = winner:WaitForChild("leaderstats").Wins.Value + 1
end
Result In Game Screenshot when testing in Multiplayer mode. Works fine in solo.