#Help withh this code

1 messages · Page 1 of 1 (latest)

stone tree
#

alright, what I am trying to do here is once a the gui button is pressed I want tthhe sigma function to activate, and once the gui is pressed again I want it to deactivate, but how do I deactivate it?

vast wagon
#

???

glacial hinge
#

i have a feeling this code isn't made by entirely by yourself since you use random.new and math.random in the same script

stone tree
stone tree
frail nebula
#

maybe

#

i dont even know what the fuck is going on in the sigma function

stone tree
frail nebula
#

oh

#

now that i understand

#

local function sigma()
while true do
if status == true then

(the rest of the codes goes here)

#

maybe you can make it an ongoing loop

#

but with an if statement

stone tree
#

it wont work still

#

I cant find a way for the function to deavtivate one thhe button is pressed again

stone tree
#

i still need help

left fable
#

When the button is pressed status = not status

frail nebula
#

okay look just give me the full sigma function

#

ill add notes alongsides with the line of codes

stone tree
#

local gui = script.Parent
local button = gui.boton

button.MouseEnter:Connect(function()
print("SIGMA")
end)

button.MouseLeave:Connect(function()
print("Mouse has left")
end)

local mg = workspace:WaitForChild("Maingame")
local Coins = mg:WaitForChild("Coins")

local Debris = game:GetService("Debris")

local ball = Instance.new("Part")
ball.Anchored = false
ball.Shape = Enum.PartType.Ball
ball.TopSurface = Enum.SurfaceType.Smooth
ball.BottomSurface = Enum.SurfaceType.Smooth
ball.Size = Vector3.new(1, 1 , 1)

local RNG = Random.new()
local MAX_VELOCITY = 10

local function sigma()
while true do
local newBall = ball:Clone()
--newBall.BrickColor = BrickColor.random()
newBall.BrickColor = BrickColor.new("Gold")
newBall.CFrame = CFrame.new(10, 10, 40)
newBall.Velocity =
Vector3.new(RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY), 0, RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY))
newBall.Parent = game.Workspace
Debris:AddItem(newBall, 1)

    task.wait(0.0001 )

    newBall.Touched:Connect(function(otherpart)

        --local humanoid = otherpart.Parent:FindFirstChild("Humanoid")        
        local player = game.Players:GetPlayerFromCharacter(otherpart.Parent)                
        local rm = math.random(1, 10)    
        


        if player  then
            player.leaderstats.Gold.Value += rm
            return        
        end
    end)    
end

end

local status = false

button.MouseButton1Click:Connect(function()
--print("SIGMAAAAAAAAAAAAAAAAAAAAAAAAAAAA")

sigma()

end)