How to teleport if you own a badge?

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)

You can accomplish this via the BadgeService

here’s your script but modified to include it

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)
1 Like

Thank you very much for this!! <3

1 Like

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