Hi. Recently I found a thing called bindable event. Now I have a question: How to use it and how to award a badge to a player with it? Help!
BindableEvents allow for a script to communicate with another script of the same context (local script with local scripts, and server scripts with server scripts). It works similar to remote events where you have to define a callback function for it in one script, then fire it in another script.
For example:
-- Script 1:
local BindableEvent = game.ReplicatedStorage.BindableEvent
BindableEvent.Event:Connect(function(arg1, arg2, arg3, ...)
print("The event was fired with the following: ", arg1, arg2, arg3, ...)
end)
-- Script 2:
local BindableEvent = game.ReplicatedStorage.BindableEvent
BindableEvent:Fire("A", "B", "C", "D", 5)
This combination of scripts will output
The event was fired with the following: A B C D 5
To award a badge to the player, you should either do it directly using a server script (game:GetService("BadgeService"):AwardBadge(plr.UserId, BadgeID)
, or use a remote event to tell the server to award it. There’s no reason why you should need a bindable event to do it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.