This is my script.
-- LocalScript
local event = game.ReplicatedStorage.Purchase:InvokeServer(ButtonClone.Name)
print(event) -- Line 48
-- ServerScript
local ModuleScript = require(game.ReplicatedStorage.Shop)
game.ReplicatedStorage.Purchase.OnServerInvoke = function(plr,name)
function buy(item,ItemID)
local Price = ModuleScript.prices[item]
local bought = string.split(plr.Bought.Value..",")
local hasBought = table.find(bought,tostring(ItemID))
if plr.leaderstats.Coins.Value >= Price and hasBought == nil then
print("it should be true")
plr.leaderstats.Coins.Value -= Price
plr.Bought.Value = plr.Bought.Value..ItemID..","
print(item)
ModuleScript.functions[item](plr)
return true
elseif hasBought == 1 then
print("it should be false") -- Line 17
ModuleScript.functions[item](plr)
return false
elseif hasBought ~= nil and hasBought ~= 1 then
print("it should be .")
return "."
-- Instance.new("BoolValue",plr).Name = "Banned"
-- plr:Kick("You have been banned.")
else
print("it should be idk whats goin on")
return "idk whats goin on"
end
end
local function gamepassBuy()
end
if ModuleScript.effectsShop[name] then
buy(name,ModuleScript.effectsShop[name])
elseif ModuleScript.ranksShop[name] then
buy(name,ModuleScript.ranksShop[name])
elseif ModuleScript.passesShop[name] then
gamepassBuy()
elseif ModuleScript.gearsShop[name] then
buy(name,ModuleScript.gearsShop[name])
end
end
So basically, if the player doesn’t have the item and has enough money, it will return true, but if the player has the item already, it returns false. If it’s neither of these situations are what’s happening, then it will return “idk whats goin on”.
Yet the output is:
it should be false - Server - ShopScript:17
nil - Client - LocalScript:48
How is the RemoteFunction returning nil when there is 0 way for it to be doing that?? Everything works properly, like the ModuleScript.functions part, so its just the return part that’s wrong.