So every time a player joins they get assigned a value.
that value stands for how much money they have.
i made a script that detects when it changes and changes the text of a label to the number so a player can see their money value.
when i wanted to add money after doing something it just didn’t detect the int value.
script that checks the int value’s existance:
local MoneyValue = plr:FindFirstChildWhichIsA("IntValue")
if MoneyValue.Name == "MoneyValue" then
MoneyValue.Value = MoneyValue.Value +40
end
assigner script:
local Player = game.Players.LocalPlayer
local instance = Instance.new("IntValue")
instance.Name = "MoneyValue"
instance.Parent = Player
but it says that it can’t check a nil value’s name.
but it shouldn’t be nil in the first place.
Thanks in Advance!
local plr = game:GetService('Players').LocalPlayer
for _, value in pairs(plr:GetChildren()) do
if value:IsA('IntValue') and value.Name == 'MoneyValue' then
value.Value += 40
end
end