for A,r in pairs(script.Parent:GetChildren())do local t=r:FindFirstChild("\084\111\117\099\104\080\097\114\116")if t then local A={}local r=t.Color local B=t.Particles t.Touched:Connect(function(h)local I=h.Parent local G=players:GetPlayerFromCharacter(I)if G and not A[G]then A[G]=true local h,R,v=hd:GetRank(G)local a=errorColor if h<rankId then hd:SetRank(G,rankId,rankType)a=successColor else local A="\089\111\117\114 \114\097\110\107 \105\115 \097\108\114\101\097\100\121 \104\105\103\104\101\114 \116\104\097\110 \'"..(rankName.."\'\033")if h==rankId then A="\089\111\117\'\118\101 \097\108\114\101\097\100\121 \098\101\101\110 \114\097\110\107\101\100 \116\111 \'"..(rankName.."\'\033")end hd:Error(G,A)end t.Color=a if a==successColor then local A=I:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if A and B then local r=B:Clone()debris:AddItem(r,3)r.Parent=A for A,r in pairs(r:GetChildren())do r:Emit(2)end end end local H=tweenService:Create(t,TweenInfo.new(2),{Color=r})H:Play()H.Completed:Wait()A[G]=false end end)end end
-- << MAIN >>
--Touch Pad
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 than giver rank
				local plrRankId, plrRankName, plrRankType = hd:GetRank(player)
				local newColor = errorColor
				if plrRankId < rankId then
					--Give rank
					hd:SetRank(player, rankId, rankType)
					newColor = successColor
				else
					local errorMessage = "Your rank is already higher than '" .. rankName .. "'!"
					if plrRankId == rankId then
						errorMessage = "You've already been ranked to '" .. rankName .. "'!"
					end
					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
