#Can someone tell me why this script doesn't work?

26 messages · Page 1 of 1 (latest)

late bramble
#

this isnt the actual full script but heres a part that doesn't work i just need an answer on why it doenst work

lua


    local function roles()
    local murd
    local shrf
    repeat
        murd = numofplayers[math.random(1,#numofplayers)]
        shrf = numofplayers[math.random(1,#numofplayers)]
    until murd ~= shrf```
severe ether
#

If there is 1 player it will not work

late bramble
#

i tried it with my friend but it still didnt work

severe ether
#

print murd and shrf

late bramble
#

okok give me a second

nocturne ginkgo
#

local t = {}
t = game.Players:GetPlayers()

severe ether
#

?

#

Why not local t = game.Players:GetPlayers()?

late bramble
#

oh let me also try that

#

it didnt print out anything btw

severe ether
#

Do you call the function?

#

Ooo

#

local murd = numofplayers[math.random(1,#numofplayers)]
local shrf = numofplayers[math.random(1,#numofplayers)]

#

Instead of
local murd
local shrf

late bramble
#

i do call the function

late bramble
severe ether
#

Yes so the repeat until will change it

#

local murd
local shfr
print(murd) -- will print nil
print(shfr) -- nil
print(murd==shfr) -- false
Since nil = nil

late bramble
#

uhh i just put a print at the start of the function and it didnt print so i think i have problems with the remote event stuff 😭 sorry for wasting you guys' times

fiery ravine
late bramble
#

thank you i didnt get any freezes but still helpful

past quartzBOT
#

studio** You are now Level 1! **studio

fiery ravine
#

Usually you might get freezes and "Roblox Studio not responding" when you are using

while true do
--code
end
--Or
repeat
--code
until
#

Roblox Studio will execute the scripts way to fast and it will freeze

nocturne ginkgo
#

wait()

severe ether