Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to display a different message if the player owns a badge?

Asked by 6 years ago

So I have this script, which is suppose to change the dialogue of the parent (which is a textbox) to say test if the player owns a certain badge, however, this does not work. I have tried a local script but currently, it is in a server script like it started off.

function game.ReplicatedStorage.checkBadge(player, badgeId)
if game:GetService("BadgeService"):UserHasBadge(player.userId,981497474) then
    script.Parent.Text = "test"
end
end

The script worked last year but since FE must be enabled I had to do some massive changes to the script, and this is no longer working.

The script is located in a gui which is found in the ReplicatedStorage. I would greatly appreciate it for some help, and if you could try to elaborate on your response rather than just saying one line of info, that would be very nice. Thanks!

1 answer

Log in to vote
0
Answered by 6 years ago

Scripts in replicatedstorage does not run.

If checkbadge is fired by the server, then your scripts needs to be put in a localscript and you need to do game.Replicated.CheckBadge.OnClientEvent:connect(function(player, BadgeId)

elseif its fired by a client, replace OnClientEvent by OnServerEvent

0
I'm a bit confused. Sorry, I don't work with scripts that much. Skepticlemon 24 — 6y
Ad

Answer this question