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

Can someone help me with my script?

Asked by 10 years ago

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?

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. RedCombee 585 — 10y
0
uhhhh okk CircIed 5 — 10y

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

@ 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.

0
This all depends on the context this specific block of code is written in. Either of you could be correct. adark 5487 — 10y
0
True.. Shawnyg 4330 — 10y
Ad

Answer this question