This is my code. | | | v local replicatedStroage = game:GetService("ReplicatedStorage") local pickKiller = replicatedStroage:WaitForChild("PickKiller") local players = game:GetService("Players") function pickkiller(people) repeat for _,playerchosen in pairs(people:GetChildren()) do local RandomNum = math.random(0,40) local TopOfTheNum = math.random(20,40) wait(0.1) if RandomNum >= TopOfTheNum then print(playerchosen.." got chosen as the killer") end end until end
There are many things wrong with your code.
Your code:
01 | local replicatedStroage = game:GetService( "ReplicatedStorage" ) -- not needed in code |
02 | local pickKiller = replicatedStroage:WaitForChild( "PickKiller" ) -- not needed in code |
03 | local players = game:GetService( "Players" ) |
04 | function pickkiller(people) -- what is people |
05 | repeat -- why are you repeating?? |
06 | for _, playerchosen in pairs (people:GetChildren()) do -- what is people |
07 | local RandomNum = math.random( 0 , 40 ) |
08 | local TopOfTheNum = math.random( 20 , 40 ) |
09 | wait( 0.1 ) |
10 | if RandomNum > = TopOfTheNum then |
11 | print (playerchosen .. " got chosen as the killer" ) |
12 | end |
13 | end |
14 | until -- until what? |
15 | end |
Edited code:
01 | local players = game:GetService( "Players" ) |
02 | function pickkiller() |
03 | for _, playerchosen in pairs (players:GetChildren()) do |
04 | local RandomNum = math.random( 0 , 40 ) |
05 | local TopOfTheNum = math.random( 20 , 40 ) |
06 | wait( 0.1 ) |
07 | if RandomNum > = TopOfTheNum then |
08 | print (playerchosen .. " got chosen as the killer" ) |
09 | end |
10 | end |
11 | end |
Answering title:
Unfortunately, you did not send the full output, so I am unable to help you.
if the code works pls accept so we both get rep