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

Trying to make a math.random Function but it's not working correctly??

Asked by 7 years ago

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()    
1
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. OldPalHappy 1477 — 7y
0
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. duckwit 1404 — 7y

Answer this question