Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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:

01replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)
02 
03    if not remoteData:FindFirstChild(player.Name) then return "No Folder" end
04 
05    local rebirths = player.leaderstats.Rebirths
06 
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()
11        return true
12    else return "Not enough strength"
13    end
14end

localscript:

01rebirthButton.MouseButton1Click:Connect(function()
02    local result = replicatedStorage.Remotes.Rebirth:InvokeServer()
03 
04    if result == true then
05        rebirthButton.Text = "Successfully rebirthed"
06        wait(1)
07        rebirthButton.Text = "CLICK HERE TO REBIRTH"
08    elseif result == "NotEnoughStrength" then
09        rebirthButton.Text = "Not strong enough"
10        wait(1)
11        rebirthButton.Text = "CLICK HERE TO REBIRTH"
12    end
13end)

Edit: When I write OnInvoke, it doesn't give error at first but when i click the button it gives the same error

1 answer

Log in to vote
0
Answered by
evaera 8028 Trusted Badge of Merit Snack Break Game Jam Winner Moderation Voter Administrator Community Moderator Super Administrator
5 years ago

You created a BindableFunction, but you need a RemoteFunction.

0
I do have a RemoteFunction BabanizPROcuk 49 — 5y
0
No evaera 8028 — 5y
0
its on the remotes folder BabanizPROcuk 49 — 5y
0
how can I turn it to a RemoteFunction BabanizPROcuk 49 — 5y
View all comments (2 more)
0
Remove the BinableFunction and replace it with RemoveFunction. Block_manvn 395 — 5y
0
The error is gone but not the whole script runs still thanks BabanizPROcuk 49 — 5y
Ad

Answer this question