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 4 years ago
Edited 4 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:

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

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
4 years ago

You created a BindableFunction, but you need a RemoteFunction.

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

Answer this question