So me and my friends are making a virus-disease-based simulator, and I am debugging some code with print statements. I cant get passed the Debounce if statement because it claims that 'Cough is not a valid member of Folder'. Please help.
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local cooldown = 1
replicatedStorage.Remotes.Cough.OnServerEvent:Connect(function(player)
print ("Fired")
if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
local debounce = remoteData[player.Name].Debounce
if not debounce.Value then
print ("Got past the Debounce if statement")
debounce.Value = true
player.leaderstats.Cough.Value = player.leaderstats.Cough.Value + 25 * (player.leaderstats.Rebirths.Value + 1)
wait(cooldown)
debounce.Value = false
end
end)
NOTE: The print statements are included for debugging. Just in case you were wondering.

4 comments
Is cough part of the ReplicatedStorage?
Yes. There is a folder called Remotes in ReplicatedStorage, inside said folder is the remote event, Cough.
How is the script supposed to work? Is it supposed to go up every few minutes or when they click a button?
When the you left-click, it is supposed to add a cough. But right now there's just a problem with the debounce.