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

How do i make a random chance of something occuring?

Asked by 4 years ago

the script I'm working with is

function Drop() 
local drops = {"ClassicSword"}
local G = math.random(1, 2)
if math.random == 1 then
    local Obj = game.Lighting:findFirstChild(drops[G]):Clone() 
    Obj.Parent = game.Workspace
    Obj.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(5,2,0)
    script:remove()
end 


while true do 
    wait(.1) 
    if (script.Parent.zombie.Health <1) then
        Drop() 
    end 
end

end

but it doesn't get past math. random I want it to have a chance of a drop rate but it doesn't drop at all

5
Should be if G == 1 sheepposu 561 — 4y
0
lol MustangHeart 67 — 4y
0
oh didn't notice lol AlphaFlame5 -1 — 4y

Answer this question