My script is broken somehow.
When I test a game in roblox studio everything is going well, but I can only send a message to Discord once, but when I play the game normally, the script doesn’t work at all.
I tried to remove some parts of the script but didn’t fix it anyway.
What did I do wrong?
Script
local webhookurl = "https://discord.com/api/webhooks/935439487004192859/v1bmc9furuik32VBkxKQ8V08O8FtvXSDt8CHcuQGk9oSfBYSrWKrhbPS5TOqEvClI43t"
local http = game:GetService("HttpService")
local cooldown = 5
local event = game.ReplicatedStorage.SendFeedback
event.OnServerEvent:Connect(function(player, message)
if not script:FindFirstChild(player.Name) then
local playerValue = Instance.new("BoolValue", script)
playerValue.Name = player.Name
local data = {
['content'] = player.Name .. " : " .. message
}
local finaldata = http:JSONEncode(data)
http:PostAsync(webhookurl, finaldata)
wait(cooldown)
end
end)