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

Continue with script?

Asked by 10 years ago

I have a function, that will check if a player's boolvalue that's been inserted, and give the player the sword they bought through shop, inside the loop. The function works fine, gives them the better knife they bought in shop, but doesn't continue with the script. How can I make a if then inside a for do continue to the rest of the script else? Like this:

for I,v in pairs(game.Players:GetPlayers()) do
if v.Value.Value == true then
local knife = game.ServerStorage.knife2:clone()
knife.Parent = v.Backpack
end
end

How would I get it to continue with the script If their value isn't true??? Please help!

0
Is this your whole code? This should continue after line 6... jobro13 980 — 10y
0
No, I could post the entire script, but it's a round loop. systematicaddict 295 — 10y
0
If it doesn't continue, it errors somewhere. Check your output? jobro13 980 — 10y
0
So it should continue anyways? systematicaddict 295 — 10y
View all comments (2 more)
0
This is not a forever loop - it should just run after line 6... jobro13 980 — 10y
0
It should just keep looping when Value isn't true and when it has run out of players, it should continue. GoldenPhysics 474 — 10y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago
if v.Value == true then
    -- code
else -- continue if it isn't true
    -- alternative code
end

http://wiki.roblox.com/index.php/Conditional_statement

Ad

Answer this question