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:
local replicatedStroage = game:GetService("ReplicatedStorage") -- not needed in code local pickKiller = replicatedStroage:WaitForChild("PickKiller") -- not needed in code local players = game:GetService("Players") function pickkiller(people) -- what is people repeat -- why are you repeating?? for _, playerchosen in pairs(people:GetChildren()) do -- what is people 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 -- until what? end
Edited code:
local players = game:GetService("Players") function pickkiller() for _, playerchosen in pairs(players: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 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