Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

OnServerInvoke is not a valid member of BindableFunction error?

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

✓ Accepted answer

You created a BindableFunction, but you need a RemoteFunction.

6 comments

0

I do have a RemoteFunction

0

No

0

its on the remotes folder

0

how can I turn it to a RemoteFunction

0

Remove the BinableFunction and replace it with RemoveFunction.

0

The error is gone but not the whole script runs still thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.