Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help My Discord Webhook For Chance Isnt Working?

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.

1 comment

0

Discord has blocked any HTTP requests that comes from Roblox to prevent spamming.

2 answers

Use hooks.hyra.io/(webhook here, just remove the discord.com)

This discussion is preserved as it was. New answers, comments, and votes are closed.