Does BadgeService work in a LocalScript?

Can anyone please tell me … Does BadgeService work in a LocalScript?

2 Likes

What are you using in badge service? for the most part yes, however awarding a badge must be done of the server. Getting a Badges Info or UserHasBadgeAsync() works on the client

3 Likes

I have a LocalScript in a TextLabel … i’ll write a code that makes the textlabel appear when player earns the badge, . So, can BadgeService work in this LocalScript?

1 Like

You can’t award a badge on the Client, but you can check if they own it. Again the roblox docs explain what you can and can’t do on the client in Badge Service So I recommend scrolls and finding what you will use, and see if its allowed to be called on a local script

3 Likes

I will most likely not understand everything in the documents smoothly. English is not my main language. I’m planning on reading it when I grow up a lil bit so that I have a better knowledge of English

edit: i have to go because it’s literally 1:39: AM for me. I got to close the computer.

1 Like

looking for the words, " server-side Script" or “local script”, “must” etc. When reading as I find thats where that info lives for future reading adventures

: AwardBadge() Must be on the server

: GetBadgeInfoAsync() Both

: UserHasBadgeAsync () Seems like both, but does mention a Little warning when using on Client Seen here

1 Like

Why not use a remote event? Much easier to deal with.

i edited my last message and told you that ill close my pc, but nvm because ill stay up alittle bit lol

Idk how to use it. I’m not the best programmer

1 Like
Make a RemoteEvent instance, parent it to ReplicatedStorage and have the two following scripts

--Server
local repStorage = game:GetService("ReplicatedStorage")
local remoteEvent = repStorage:WaitForChild("RemoteEvent") -- name will depend ofc

function action()
   --when something happens
   local player = --get the player
   remoteEvent:FireClient(player, "MESSAGE") -- first argument is the client recieving the remote fire
end

--client
local repStorage = game:GetService("ReplicatedStorage")
local remoteEvent = repStorage:WaitForChild("RemoteEvent") -- name will depend ofc

remoteEvent.OnClientEvent:Connect(function(MESSAGE) -- you can send as much data as you want but watch out from sending too many bytes for performance's sake
   print(MESSAGE)
end)
1 Like

You can award the badge then send what badge was awared to the server threw a remote event.

1 Like

Tin already covered it my bad :smile:

1 Like

I’ll try it out. Thank you:)

[30letters]

To the client I ment*

[char 2.0]

1 Like

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