How can I make a teleporter that when you touch it, it teleports you to another experience, but the thing is let’s say for example the game has 100 badges, how do I make it so that if you own any 5 badges of these 100 badges, then it allows you to teleport to the other experience, otherwise it won’t teleport you?
You can use BadgeService:UserHasBadgeAsync().
But be aware that this function has limits so I don’t think you can run 100 badge checks in a second.
1 Like
Try this -
local Badges = {2126174440} -- Put your badgeID's here
local TeleportService = game:GetService("TeleportService")
local BadgeService = game:GetService("BadgeService")
local userHasBadge = BadgeService.UserHasBadgeAsync
local awardBadge = BadgeService.AwardBadge
script.Parent.Touched:Connect(function(obj)
if obj.Parent:FindFirstChild("Humanoid") then
for _,badge in pairs(Badges) do
local success, result = pcall(userHasBadge, BadgeService, game.Players:GetPlayerFromCharacter(obj.Parent).UserId, badge)
if success then
if not result then
TeleportService:Teleport(147536429,game.Players:GetPlayerFromCharacter(obj.Parent))
local success2, result2 = pcall(awardBadge, BadgeService, game.Players:GetPlayerFromCharacter(obj.Parent).UserId, badge)
if success2 then
if result2 then
end
end
end
end
end
end
end)
What it does:
Checks if the player who touched the brick has all the badges in the list , and if he does, it will teleport him.
1 Like
Thank you very much for this!!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.