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

Roblox not registering team change for Money gui, can you help me solve it?

Asked by
Na_n 0
4 years ago
local DataStoreService = game:GetService("DataStoreService")
local ds = DataStoreService:GetDataStore("money")

local paycheck = Instance.new("RemoteEvent")
paycheck.Parent = game.ReplicatedStorage
paycheck.Name = "paycheck"


game.Players.PlayerAdded:Connect(function(player)
    local a = true
    while a do

        if player.Team.Name == "Citizen" then
            wait(10)
            local value = player.leaderstat.Money.Value
            value = value+50 
            player.leaderstat.Money.Value = value
            increment = 50

            paycheck:FireClient(player,increment)



        elseif player.Team.Name == "Police" then
            wait(10)
            local value = player.leaderstat.Money.Value
            value = value+70 
            player.leaderstat.Money.Value = value
            increment = 70

            paycheck:FireClient(player,increment)
        end

    end
end)

I have this. However, if I change my team to Police, roblox does not register the fact I've changed teams and so still gives me the 50, despite being on the police team, so I should be getting 70. Any help would be much appreciated.

1 answer

Log in to vote
0
Answered by 4 years ago

IDK im not sure but try making a string value and let it say like what the job is and this make it so it says

If script.Parent == "Police" then

while true do

wait(3)

game.Player.LocalPlayer.Money = game.Player.LocalPlayer.Money +10

0
It's a server script Na_n 0 — 4y
Ad

Answer this question