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

i need help with the BadgeService:UserHasBadge, can someone help me?

hi, i'm trying to make this script open a frame, but only with players who have a specific badge, i'm desperate with this, i tried many things but it doesn't work, hope someone can help me <3.

screnshoot: https://gyazo.com/5533f700b26c8b3a05904f0443ac4127?token=489b7d84a4f36de57c3ddf9c6ec25aa6

local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")

local BadgeId = 2124596127


game:GetService("Players").PlayerAdded:Connect(function(player)
	local player = Players.LocalPlayer
	local hasBadge = true
	if BadgeService:UserHasBadge(player, BadgeId) then
	end
	script.Parent.MouseButton1Click:Connect(function()
		if hasBadge then
			
				script.Parent.Parent.Group.Visible = false
				script.Parent.Parent.Group.BackgroundTransparency = 1
				script.Parent.Parent.Normal.Visible = false
				script.Parent.Parent.Normal.BackgroundTransparency = 1
				script.Parent.Parent.Villanos.Visible = false
				script.Parent.Parent.Villanos.BackgroundTransparency = 1
				script.Parent.Parent.BadgeFrame.BackgroundTransparency = 0
				script.Parent.Parent.BadgeFrame.Visible = true	
		end
		end)
end)

1 answer

Use this in a serverscript.


local BadgeId = 2124596127

game.Players.PlayerAdded:Connect(function(Player)

	if game:GetService("BadgeService"):UserHasBadge(Player, BadgeId) then

		--Here, copy the GUI that you want to have a button when you have a certain badge to Player.PlayerGui. Your code could easily be bypassed by exploiters.

	end

end)

1 comment

0

omg tysm!

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