#Help withh this code
1 messages · Page 1 of 1 (latest)
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
yea, I experimented with the script provided by the roblox documentation
oh now I know why I was not able to send it
--declare a boolean first--
status = false
button.MouseButton1Click:Connect(function()
if status == false then -- activates
sigma()
else -- deactivates
-- put original state or off state here--
end
end)
maybe
i dont even know what the fuck is going on in the sigma function
it justs endlessly generates balls
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
it wont work still
I cant find a way for the function to deavtivate one thhe button is pressed again
i still need help
He literally told u what to do
When the button is pressed status = not status
okay look just give me the full sigma function
ill add notes alongsides with the line of codes
I am illeterate
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)