Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

1 comment

0

It's a server script

This discussion is preserved as it was. New answers, comments, and votes are closed.