Ok so the script worked before I added the math.random lines but I'm trying to make a frame appear in PlayerGui if the random numbers equal 1 or 2 but can't seem to make it work, I'm getting no errors?
local Humanoid = script.Parent.Enemy num = nil function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:findFirstChild("PlayerGui") if Leaderstats ~= nil then function GetDaNumba() num = math.random(1,3) if num == 1 or num == 2 then Leaderstats.MonsterItem.Box.Visible = true script:remove() end end end end end end Humanoid.Died:connect(PwntX_X) GetDaNumba()