So Im Making A Game With Luck And Im trying to make it so when someone gets a certain rng it sends in discord, but theres a glitch here the script. (Dont Mind all The Ifs)
Button.MouseButton1Click:Connect(function() tt.Value += 1 -- adds to total ttr.Value += 1 -- adds to total tis run repeat -- repeats picking random number and adding 1 to num until the random number is 1 local ran = math.random(1,2) num += 1 print(best2.Value) print(num) until ran == 1 if num >= best2.Value then if num > best2.Value then best2.Value = num --if num is bigger than current best it will set the best to the current num end end if math.pow(2, num) >= 10000 then rng1.Value += 1 if math.pow(2, num) >= 100000 then rng2.Value += 1 if math.pow(2, num) >= 1000000 then rng3.Value += 1 end end end if num <= best2.Value then jg.Text = "This bar is currently unavailable until next update(and this time i mean it)." --too lazy to add this part rn end -- i cut out a chunk so this isnt super long local httpService = game:GetService("HttpService") local webhookUrl = "notgonnashare" -- Paste the webhook URL given by discord. local contentData = { ["content"] = ">>> "..plr.Name.." Just Got RNG: 1/"..math.pow(2, num) } local sentData = httpService:JSONEncode(contentData) if math.pow(2, num) >= 10000 then httpService:PostAsync(webhookUrl, sentData) -- send the data to the url in a JSON format. end num = 0 --sets num to 0 if best2.Value >= 100 or num >= 100 then --checks if theres no glitch num = 0 best2.Value = 0 end end)
But the problem is whenever someone gets 10000 chance then it sends the message but somehow the num goes up a bunch making the best go up and breaks the game and i have no idea how to fix this. Even If I Set num to 0 it doesnt seem to work.
Hello! Sadly Discord has blocked all HTTP requests made by users on the platform due to mass spam and users abusing this webhook feature. Please look at this link to learn more: https://devforum.roblox.com/t/discord-webhook-http-forbiddeon/1499542?page=2