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()

2 comments
God, this would be 100 times easier to read if you understood the concept of spacing/tabbing your code correctly, and the overall importance of it.
Please use the Lua Style Guide, available here: http://wiki.roblox.com/index.php?title=Lua_Style_Guide#Indentation. Making readable code is essential for understanding it yourself and discussing it with others.