When a player touch an brick they will be teleport to an other place but if they touch it without having the badges that are needed their will show up an gui.

They need the found example 3 badges until then can teleport to it. When they don't found the correct onces they get an gui on their screen.

On an brick(part) when they touches it.

Full script:

game:GetService('TeleportService').CustomizedTeleportUI = true
local BadgeService = game:GetService("BadgeService")
local badges  = {229929415, 229929797, 229929912}
local debounce = false

function getPlayer(Part)
	local Humanoid = Part.Parent:FindFirstChild('Humanoid')
	if (Humanoid ~= nil) then
		local Character = Humanoid.Parent
		if (Character ~= nil) then
			return game:GetService('Players'):GetPlayerFromCharacter(Character)		
		end
	end
end

function onTouch(part)
	if BadgeService:UserHasBadge(player.UserId, badges) then
		function _sendPlayerToLobby(player)
		local playerIdentity = player.Name .. '(' .. player.userId .. ')'
		game:GetService('TeleportService'):Teleport(195733678, player)	
	end
		local sendPlayerToLobby = debounce(_sendPlayerToLobby)
 			function onTouch(Source)
				local player = getPlayer(Source)	
				if player then
				if player.userId > 0 then	
				sendPlayerToLobby(player)
				end		
			end	
		end
	end
elseif script.Parent.NeededGUI:clone().Parent = player.PlayerGui then
	end
end

Parts of script:

The badges:

local badges  = {229929415, 229929797, 229929912}

Send player too other place and if player doesn't have the badges gui comes up:

if BadgeService:UserHasBadge(player.UserId, badges) then
		function _sendPlayerToLobby(player)
		local playerIdentity = player.Name .. '(' .. player.userId .. ')'
		game:GetService('TeleportService'):Teleport(195733678, player)	
	end
		local sendPlayerToLobby = debounce(_sendPlayerToLobby)
 			function onTouch(Source)
				local player = getPlayer(Source)	
				if player then
				if player.userId > 0 then	
				sendPlayerToLobby(player)
				end		
			end	
		end
	end
elseif script.Parent.NeededGUI:clone().Parent = player.PlayerGui then
	end
end

I did mess it up I think. Does someone know how I can fix this. Thank you :)

minetrackmania

2 comments

1

I can not understand what you're trying to accomplish. Please restate the question.

0

better?