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

Why is it skipping over this part of the script?

Asked by
wjs3456 90
10 years ago

I have this part of the script that works:

function FirstInfected(text,time)
wait(18)
players = game.Players:GetPlayers()
for i,v in pairs(game.Players:GetPlayers()) do
if #players>=1 then
    Wait()
    first_infected = players[math.random(1, #players)]
    first_infected.TeamColor = BrickColor.new("Bright orange")
    initial_loadout = game.Lighting.Revolver
    initial_loadout:clone().Parent = first_infected.Backpack

Then this part that nothing happen at all(no error messages):

if v.TeamColor == BrickColor.new("Bright orange")then
            survive_loadout = game.Lighting.Ak_47
            survive_loadout:clone().Parent = v.StarterGear          
        if v.TeamColor == BrickColor.new("Bright orange")then
                v.Character.Humanoid.WalkSpeed = 30
        end
        end
    end

Then this part continues on and works:

local h = Instance.new("Hint",Workspace)
    h.Text=text
    wait(time)
    h:Destroy()
    end
end


FirstInfected("A player has been randomly infected!",3)

Why does it do this? Thanks

1 answer

Log in to vote
-2
Answered by
lomo0987 250 Moderation Voter
10 years ago
if v.TeamColor == BrickColor.new("Bright orange")then
            survive = game.Lighting.Ak_47
            survive:clone() 
            survive.Parent = v.StarterGear   
        if v.TeamColor == BrickColor.new("Bright orange")then
                v.Character.Humanoid.WalkSpeed = 30
        end
        end
    end

Try this.. I just cleaned it up and I don't believe you cant use _ when doing that? I might be wrong. But it doesn't look clean with it.

0
Hmmm it still doesn't effect my walkspeed. wjs3456 90 — 10y
0
Ok I have no clue what I did but it worked now wjs3456 90 — 10y
0
okay that's good :D lomo0987 250 — 10y
0
Of course you can use `_` in variable names. This answer is also WRONG since it doesn't use the `clone` created while the original answer did. This answer will work exactly once. BlueTaslem 18071 — 10y
0
Isn't that is needed? for it to work only once? lomo0987 250 — 10y
Ad

Answer this question