Hello! I am working on a system that will give extra money if the player has a BoolValue that is true. I’m having an issue with consistently checking the Player to see if it is true, yet I’m getting errors. How can I be able to check the local player if their value is true or not?
Code is below
This is from a script in ServerScriptService
game.Players.PlayerAdded:Connect(function(plr)
local bool = Instance.new("BoolValue",plr)
bool.Name = "King"
bool.Value = false
end)
local MoneyBonus = 0
while wait(1) do
if Player.King.Value == true then
MoneyBonus = 0.5
else
MoneyBonus = 0
end
end
local bonus = MoneyBonus * Income
Any help on figuring this out is greatly appreciated!
Yeah the system is able to change the value. I was having issues with making the value false if the king leaves or dies and that only one person can have the value be set to true.
And how can I take that and add it to a new function so it gets included in the income? When I put in MoneyBonus in the income I get this error. “ServerScriptService.Main:404: attempt to perform arithmetic (mul) on nil and number”