Im trying to make a feedback system in a server script inside a GUI but somehow it doesn’t print anything? There were no errors.
local httpservice = game:GetService('HttpService')
local datastoreservice = game:GetService('DataStoreService')
local timedatastore = datastoreservice:GetDataStore('webhookData')
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local defaultTime = {
['day'] = os.date('%a'),
['month'] = os.date('%m'),
['year'] = os.date('%Y')
}
local webhooks = {
['suggestion'] = NO,
['bug'] = NO
}
function isMatching(data)
if data then
local day = data.day[1]
local month = data.month[1]
local year = data.year[1]
if day ~= defaultTime.day or month ~= defaultTime.month or year ~= defaultTime.year then
return true
else
return false
end
else
return true
end
end
function readyToSend()
local success, err = pcall(function()
data = timedatastore:GetAsync(player.UserId)
end)
if success and isMatching(data) then
local s, e = pcall(function()
data = timedatastore:SetAsync(player.UserId, defaultTime)
end)
if s then
return true
else
warn(e)
return false
end
elseif not success then
warn(err)
return false
elseif not isMatching(data) then
return 'NotAvail'
end
end
function sendResponse(response, responseType)
if readyToSend() then
local data = {
['content'] = '',
['embeds'] = {
{
["title"] = player.Name..' says...',
["description"] = response,
['type'] = 'rich',
['footer'] = player.UserId
}
}
}
local messageData = httpservice:JSONEncode(data)
if responseType == 'bug' then
httpservice:PostAsync(webhooks.bug,messageData)
warn('Message sent')
else
httpservice:PostAsync(webhooks.suggestion,messageData)
warn('Message sent')
end
elseif readyToSend() == 'NotAvail' then
return 'no'
elseif not readyToSend() then
return false
end
end
local function lostFocusBug(pressedEnter)
if pressedEnter and player.AccountAge <= 31 then
warn('test')
local returned = sendResponse()
if returned == 'no' then
script.Parent.bugbox.PlaceholderText = 'Come back tommorow to send another bug!'
else
script.Parent.bugbox.PlaceholderText = 'An error occured.'
end
end
end
script.Parent.bugbox.FocusLost:Connect(lostFocusBug)