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

This script doesn't give points! Help please?

Asked by 10 years ago

It's not to give player points, it has to give points in-game. But it doesn't. Here's the code:

function checkBlue()
    local bluecount = 0
    if game.Workspace.RoundRunning.Value == true then
        for i = 1, #players do
            if players[i].Character ~= nil then
                if players[i].Team.Value == "BlueTeam" then
                    bluecount = bluecount + 1
                end
            end
        end
    end
    if bluecount == 0 then
        time.Value = 0
        game.Workspace.RoundRunning.Value = false
        gm.Value = "The red team has won!"
        wait(2)
        gm.Value = "Awarding 15 points to red team (+15 Player Benefits)"
        for i = 1, #players do
            if players[i].Team.Value == "RedTeam" then
                if players[i].PlayerStats.PlayerBenefits == true then
                    players[i].PlayerStats.Points.Value = players[i].PlayerStats.Points.Value + 30
                    players[i].PlayerStats.PlayerWins.Value = players[i].PlayerStats.PlayerWins.Value + 1
                    players[i].PlayerStats.RoundsPlayed.Value = players[i].PlayerStats.RoundsPlayed.Value + 1
                elseif players[i].PlayerStats.PlayerBenefits == false then
                    players[i].PlayerStats.Points.Value = players[i].PlayerStats.Points.Value + 15
                    players[i].PlayerStats.PlayerWins.Value = players[i].PlayerStats.PlayerWins.Value + 1
                    players[i].PlayerStats.RoundsPlayed.Value = players[i].PlayerStats.RoundsPlayed.Value + 1
                end
            elseif players[i].Team.Value == "BlueTeam" then
                players[i].PlayerStats.RoundsPlayed.Value = players[i].PlayerStats.RoundsPlayed.Value + 1
            end
        end
    end
end

1 answer

Log in to vote
0
Answered by
Mauvn 100
10 years ago

You have to Declare the Service in order that you're telling the script you are talking about PP's

Put this it should work :)

local PointsService = Game:GetService("PointsService")

If there is anything i'm happy to help you :)

If this helped +1 me please! :)

Ad

Answer this question