No errors being sent - everything is being printed correctly, apart from cooldown
Can you show your output from a test of this?
yeah me spamming it
Is the rest of your script working correctly,
Try adding a wait() before refreshDB = false
He has the wait in the for loop to make it wait and change the time left.
Yeah everything else is working fine - Just added the wait() and it didnt work either.
Also, you can do
for refreshDBTime, 5, 0, -1 do
task.wait(1)
end
in place of having to create a variable then set the other one.
Can you try printing refreshDB after you set it to true, in the for loop, and before and after you set it to false?
After Refresh DB is set to true, there is no statement setting it back to false. You will just have to add RefreshDB = false
after your elseif statement.
This has to be inside the elseif block. It is otherwise ignored.
That block should still be running from the first time the button is clicked.
Pretty sure its an issue with my refreshList() function as nothing gets printed after that
(highligted doesnt get printed)
I’ll take a look at my function and if that doesnt work i’ll let you know
I just recreated your code in studio and tested it and it worked fine. It says “Cooldown” when I spam it.
What’s in your refreshList() function?
local function refreshList()
print('Refresh list')
for _,v in pairs(script.Parent.bg.chattags.ScrollingFrame:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
wait(0.01)
end
end
print('Deleted frames')
local PlayerData = game.ReplicatedStorage.Events.SentToServer.GetProfile:InvokeServer().Data
repeat task.wait() until PlayerData
print('Got data')
for _, JSONtag in pairs(PlayerData.ChatTags) do
wait(0.01)
local template = game.ReplicatedStorage.chattagTemplate:Clone()
local tagInfo = game:GetService("HttpService"):JSONDecode(JSONtag)
template.content.Text = tagInfo.Content
template.BackgroundColor3 = Color3.new(tagInfo.Color.R, tagInfo.Color.G, tagInfo.Color.B)
if tagInfo.Equiped then
template.equip.BackgroundColor3 = Color3.fromRGB(255, 52, 52)
template.equip.Text = "Unequip"
elseif not tagInfo.Equiped then
template.equip.BackgroundColor3 = Color3.fromRGB(76, 255, 0)
template.equip.Text = "Equip"
end
end
print('Done')
end
nevermind i did make it 30 00000000
Oops! If that’s associated with the
repeat task.wait() until PlayerData
line, then I think I was right, because that’s the first thing I saw that I thought would be yielding the rest of the function.
Also, with debounce, you should always set that before you do anything in your code.
--instead of this
--code
debounce = true
wait()
debounce = false
--do this
debounce = true
--code
wait()
debounce = false
put your debounce (the refreshDB = true
) before the refreshList()
line since functions will yield until it has been completed.
EDIT: nvm someone answered quicker than me xD
Hi - yeah i fixed it
here:
local PlayerData = game.ReplicatedStorage.Events.SentToServer.GetProfile:InvokeServer().Data
I was getting .data however I already return it with .data
i should check before posting
sorry for your time
No worries, I have the rest of the day off so I’m just patrolling the forums seeing who I can help with scripting stuff. haha