So I tried making a check for my shop so that I don't scam the players. So that if the event isn't running then they won't buy it. And It doesn't work. Here's the code. ServerScript:
local function checkEvent() if not EventRunning then return true else return false end end game.ReplicatedStorage.CheckEvent.OnServerInvoke = checkEvent()
LocalScript:
Frame.ShpBuy2.MouseButton1Click:Connect(function() local ChckEvnt = EventCheck:InvokeServer() print(ChckEvnt) if ChckEvnt then MarketService:PromptProductPurchase(plr, 1009546097) else print("No event is running!") end end)
game.ReplicatedStorage.CheckEvent.OnServerInvoke = checkEvent()
On this line here, you're calling checkEvent and assigning the returned value. Remove the parenthesis to assign the function itself instead:
game.ReplicatedStorage.CheckEvent.OnServerInvoke = checkEvent