Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is it skipping over this part of the script?

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

✓ Accepted answer
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.

5 comments

0

Hmmm it still doesn't effect my walkspeed.

0

Ok I have no clue what I did but it worked now

0

okay that's good :D

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.

0

Isn't that is needed? for it to work only once?

This discussion is preserved as it was. New answers, comments, and votes are closed.