Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is If statement is being ignored?

Asked by 4 years ago
Edited 4 years ago

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.

01local upgrader = workspace.Upgraders.Upgrader1
02local bean = upgrader.Bean
03 
04script.Parent.Touched:Connect(function(Part)
05    if Part.Parent:FindFirstChild("Humanoid") then
06        local Jugador = game.Players:GetPlayerFromCharacter(Part.Parent)
07        if Jugador ~= nil then
08            if Jugador.Valor.Value > 999 then
09                Jugador.Valor.Value = Jugador.Valor.Value - 1000
10                upgrader.Transparency = 0
11                upgrader.CanCollide = true
12                bean.Transparency = 0.7
13                workspace.Upgraders.Upgrader1.Bean.upgradeador1.Disabled = false
14            end
15        end
16    end
17end)

1 answer

Log in to vote
0
Answered by 4 years ago

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.

0
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 AssassinJackCCP 0 — 4y
0
Sorry for the late reply, but what kind of script is this? Dothemariobowp9 24 — 4y
Ad

Answer this question