I have this Part that has a ClickDetector inside of it, and when you click it, it will teleport you to another Part that I have named & placed somewhere in the game.
Now the Part script works perfectly fine and teleports you when you click it, but I wanted to edit it and make it so that it ONLY teleports you if you own a specific badge from the game, how would I do that?
The current script inside of the Part:
local ClickDetector = script.Parent.ClickDetector
local TP = script.Parent.Parent.TP2
ClickDetector.MouseClick:Connect(function(plr)
plr.Character:MoveTo(TP.Position)
end)
local ClickDetector = script.Parent.ClickDetector
local TP = script.Parent.Parent.TP2
local BadgeService = game:GetService("BadgeService")
ClickDetector.MouseClick:Connect(function(plr)
if BadgeService:UserHasBadgeAsync(plr.UserId, 000000000) then -- Replace 000000000 with your badge ID
plr.Character:MoveTo(TP.Position)
end
end)