OnServerInvoke is not a valid member of BindableFunction error?
Asked by
5 years ago Edited 5 years ago
When I am trying to run the game its gives the "OnServerInvoke is not a valid member of BindableFunction"
This is the code:
Script:
01 | replicatedStorage.Remotes.Rebirth.OnServerInvoke = function (player) |
03 | if not remoteData:FindFirstChild(player.Name) then return "No Folder" end |
05 | local rebirths = player.leaderstats.Rebirths |
07 | if player.leaderstats.Strength.Value > = math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt( 5000000 ))) then |
08 | rebirths.Value = rebirths.Value + 1 |
09 | player.leaderstats.Strength .Value = 0 |
10 | player:LoadCharacter() |
12 | else return "Not enough strength" |
localscript:
01 | rebirthButton.MouseButton 1 Click:Connect( function () |
02 | local result = replicatedStorage.Remotes.Rebirth:InvokeServer() |
04 | if result = = true then |
05 | rebirthButton.Text = "Successfully rebirthed" |
07 | rebirthButton.Text = "CLICK HERE TO REBIRTH" |
08 | elseif result = = "NotEnoughStrength" then |
09 | rebirthButton.Text = "Not strong enough" |
11 | rebirthButton.Text = "CLICK HERE TO REBIRTH" |
Edit: When I write OnInvoke, it doesn't give error at first but when i click the button it gives the same error