Can someone help me understand how to use "ResetButtonCallback"?

So basically, I read about a ResetButtonCallback functionality that lets me link it to an event. I want the player to only be allowed to reset in some cases, and be given a warning otherwise. Apparently it has to be linked to a BindableEvent, which I am puzzled by, due to the fact that :SetCore() can only be called from the client. This means that the event I link it to can’t fire at all. Keep in mind that the BindableEvent I used is in ReplicatedStorage.

Server Script:

print("script running")
game:GetService("ReplicatedStorage").reset.Event:Connect(function()
    print("received")
end)

Local Script:

local coreCall do
    local MAX_RETRIES = 8

    local StarterGui = game:GetService('StarterGui')
    local RunService = game:GetService('RunService')

    function coreCall(method, ...)
        local result = {}
        for retries = 1, MAX_RETRIES do
            result = {pcall(StarterGui[method], StarterGui, ...)}
            if result[1] then
                break
            end
            RunService.Stepped:Wait()
        end
        return unpack(result)
    end
end

coreCall('SetCore', 'ResetButtonCallback', game.ReplicatedStorage.reset)

(yes, I am using @Fractality_alt 's method)

There are no errors from the console, and the only thing printed from the Server Script is script running. I do know that it attempted to fire a signal, because I don’t die when i try to reset.

I would also like to know if there is a way to detect which player was trying to reset.

Any help would be appreciated!

BindableEvents do not work across the client-server boundary. You should create the BindableEvent on the client, and fire a RemoteEvent in there to the server.

Oh. I just reread the documentation for BindableEvents and just realized that it can be used for client-client instead of just server-server. Thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.