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

Can someone help me with my script?

This script keeps picking the same people over and over again.

local c = game.Players:GetPlayers()
special = c[math.random(1,#c)]

sword = game.Lighting.Sword5:Clone()
sword.Parent = special.Backpack
special.Character.Humanoid.WalkSpeed = 20
special.Character.Humanoid.MaxHealth = 200
special.Character.Humanoid.Health = 200

Why is that?

2 comments

1

A computer cannot legitimately pick something at random, so it goes by a long pattern. That person may just tend to be that beginning of the pattern.

0

uhhhh okk

1 answer

@ Red, Not necessarily. There's no definite pattern. If this is in a round that contains a while loop, I recommend putting this at the beginning of the loop, not before. If it's before, then you'll have the same person over and over again.

2 comments

0

This all depends on the context this specific block of code is written in. Either of you could be correct.

0

True..

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