I'm gettting this error: "09:56:24.608 ServerScriptService.Remotes:13: attempt to call a Instance value - Server - Remotes:13"
I don't know how to fix this one (I am new so I have to learn a lot)
Code:
local replicatedStorage = game:GetService("ReplicatedStorage") local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local cooldown = 1
replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)
print("Fired") if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end local debounce = remoteData(player.Name).Debounce - - The Error Is in this line print("Got past the Debounce variable") if not debounce.Value then debounce.Value = true player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 25 * (player.leaderstats.Rebirths.Value + 1) wait(cooldown) debounce.Value = false end
end)
An instance is basically any Roblox object, and it looks like remoteData is a folder or something but I'm not really sure. You're calling remoteData like you would call a function, but remoteData is an instance and not a function, so it gives an error
I think you were trying to do this on line 6
local debounce = remoteData[player.Name].Debounce
and made a typo, but if you don't know what this does, here is an explanation:
Roblox represents objects in the Explorer with tables, and "workspace.Folder.Part" is just a nicer way to write workspace["Folder"]["Part"] (and you can do this with any table if you use strings as keys:
local myTable = { ["hello"] = "world" } print(myTable.hello) --> "world" print(myTable["hello"]) --> "world"
Getting a value in a table using the nicer syntax is more strict, so you couldn't do this
local debounce = remoteData.player.Name.Debounce
so you need to do this
local debounce = remoteData[player.Name].Debounce