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)

2 comments
Yeah, all players have the Valor.Value inside of them, also that value can go over 999, if I put another code like Jugador.Valor.Value = Jugador.Valor.Value - 100 for example, WITHOUT the If statement, it works
Sorry for the late reply, but what kind of script is this?