I have a very simple question, why my If statement is not working after -If Jugador ~= nil then-, after this the next If statement (if Jugador.Valor.Value > 999 then) is not working but if I put another code for example Jugador.Valor.Value = Jugador. Valor.Value - 1000 without the -If Jugador.Valor.Value > 999 then- it works.
PD: The output shows no errors or warnings.
local upgrader = workspace.Upgraders.Upgrader1 local bean = upgrader.Bean script.Parent.Touched:Connect(function(Part) if Part.Parent:FindFirstChild("Humanoid") then local Jugador = game.Players:GetPlayerFromCharacter(Part.Parent) if Jugador ~= nil then if Jugador.Valor.Value > 999 then Jugador.Valor.Value = Jugador.Valor.Value - 1000 upgrader.Transparency = 0 upgrader.CanCollide = true bean.Transparency = 0.7 workspace.Upgraders.Upgrader1.Bean.upgradeador1.Disabled = false end end end end)
Have you made sure to add the Valor inside of the Player? If so, has it been programmed to go over 999? If not, then it won't trigger.