When I am trying to run the game its gives the "OnServerInvoke is not a valid member of BindableFunction"
This is the code: Script:
replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player) if not remoteData:FindFirstChild(player.Name) then return "No Folder" end local rebirths = player.leaderstats.Rebirths if player.leaderstats.Strength.Value >= math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(5000000))) then rebirths.Value = rebirths.Value + 1 player.leaderstats.Strength .Value = 0 player:LoadCharacter() return true else return "Not enough strength" end end
localscript:
rebirthButton.MouseButton1Click:Connect(function() local result = replicatedStorage.Remotes.Rebirth:InvokeServer() if result == true then rebirthButton.Text = "Successfully rebirthed" wait(1) rebirthButton.Text = "CLICK HERE TO REBIRTH" elseif result == "NotEnoughStrength" then rebirthButton.Text = "Not strong enough" wait(1) rebirthButton.Text = "CLICK HERE TO REBIRTH" end end)
Edit: When I write OnInvoke, it doesn't give error at first but when i click the button it gives the same error
You created a BindableFunction, but you need a RemoteFunction.