Even though I added .Value to the end of the variable, it still pops up that error.
The error is on the line 25. GemsNeeded is a number value.
wait(1)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventsFolder = ReplicatedStorage:WaitForChild("EventsFolder")
local Event = EventsFolder:WaitForChild("SendExchangeRequest")
for _,Player in pairs(game.Players:GetChildren()) do
wait()
local function RequestApproved(Material, MatAmount)
local Material_Value = Player:WaitForChild("Database"):WaitForChild(Material.."_Value")
Material_Value.Value = Material_Value.Value + MatAmount
-- End
end
local function RequestCheck(GemsNeeded, Material, MatAmount)
local Gem_Value = Player:WaitForChild("Database"):WaitForChild("Value_Inv"):WaitForChild("Gem_Value")
print("Checking if the user has enough Gems!")
wait()
if Gem_Value.Value >= GemsNeeded then
-- Taking a needed gems value num from player gem value.
print("Request Valid!")
Gem_Value.Value = Gem_Value.Value - GemsNeeded
-- Extraction to the RequestApproved funct.
RequestApproved(Material, MatAmount)
end
end
-- This is where the server receives a request
Event.OnServerEvent:Connect(function(GemsNeeded, Material, MatAmount)
RequestCheck(GemsNeeded, Material, MatAmount)
end)
end

2 comments
"Calling tables" that's not gonna work unless your table has a metatable with a __call metamethod pls fix terminology
I've tried it now and it keeps saying the same error...