for L,c in pairs(script.Parent:GetChildren())do local U=c:FindFirstChild("\084\111\117\099\104\080\097\114\116")if U then local L={}local c=U.Color local M=U.Particles U.Touched:Connect(function(r)local W=r.Parent local A=players:GetPlayerFromCharacter(W)if A and not L[A]then L[A]=true local r,q,t=hd:GetRank(A)local o=errorColor if r<=rankId then hd:UnRank(A)o=successColor else local L="\089\111\117\114 \114\097\110\107 \105\115 \116\111\111 \104\105\103\104 \116\111 \098\101 \117\110\114\097\110\107\101\100\033"hd:Error(A,L)end U.Color=o if o==successColor then local L=W:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if L and M then local c=M:Clone()debris:AddItem(c,3)c.Parent=L for L,c in pairs(c:GetChildren())do c:Emit(2)end end end local N=tweenService:Create(U,TweenInfo.new(2),{Color=c})N:Play()N.Completed:Wait()L[A]=false end end)end end

for a,b in pairs(script.Parent:GetChildren()) do
	local touchPart = b:FindFirstChild("TouchPart")
	if touchPart then
		local touchDe = {}
		local originalColor = touchPart.Color
		local particles = touchPart.Particles
		touchPart.Touched:Connect(function(hit)
			local character = hit.Parent
			local player = players:GetPlayerFromCharacter(character)
			if player and not touchDe[player] then
				touchDe[player] = true
				
				--Check rank is lower or equal to giver rank
				local plrRankId, plrRankName, plrRankType = hd:GetRank(player)
				local newColor = errorColor
				if plrRankId <= rankId then
					--Remove rank
					hd:UnRank(player)
					newColor = successColor
				else
					local errorMessage = "Your rank is too high to be unranked!"
					hd:Error(player, errorMessage)
				end
				
				--Change pad color
				touchPart.Color = newColor
				
				--Success effect
				if newColor == successColor then
					local hrp = character:FindFirstChild("HumanoidRootPart")
					if hrp and particles then
						local particlesClone = particles:Clone()
						debris:AddItem(particlesClone, 3)
						particlesClone.Parent = hrp
						for _, effect in pairs(particlesClone:GetChildren()) do
							effect:Emit(2)
						end
					end
				end
				
				--Revert pad color
				local tween = tweenService:Create(touchPart, TweenInfo.new(2), {Color = originalColor})
				tween:Play()
				tween.Completed:Wait()
				
				touchDe[player] = false
			end
		end)
	end
end



