game:WaitForChild("Players").PlayerAdded:Connect(function(player)
end)
local Button = game.Workspace.PortalArea.Light1
local ClickDetector = script.Parent
local BadgeService = game:GetService("BadgeService")
local BadgeId = 000000000
local player = game.Players.LocalPlayer
ClickDetector.MouseClick:Connect(function()
if BadgeService:UserHasBadgeAsync(player.UserId, BadgeId) then
Button.Color = Color3.new(0, 255, 0)
end
end)
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
local Button = game.Workspace.PortalArea:WaitForChild("Light1")
local ClickDetector = script.Parent
ClickDetector.MouseClick:Connect(function()
local player = Players.LocalPlayer
if player then
local userId = player.UserId
if BadgeService:UserHasBadgeAsync(userId, 2146480330) then
Button.Color = Color3.new(0, 255, 0)
end
end
end)
Try this, place the script inside of a click detector.
you cant use localplayer in a serverscript because the server has no idea which player you are (also make sure to set the BadgeId to a valid one)
local Button = game.Workspace.PortalArea.Light1
local ClickDetector = script.Parent
local BadgeService = game:GetService("BadgeService")
local BadgeId = 000000000
ClickDetector.MouseClick:Connect(function(Player)
if BadgeService:UserHasBadgeAsync(Player.UserId, BadgeId) then
Button.Color = Color3.new(0, 255, 0)
end
end)