Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService("RunService")
- local TS = game:GetService("TweenService")
- local CloseButton = script.Parent:WaitForChild("CloseButton")
- local Frame = script.Parent:WaitForChild("ScrollingFrame")
- local open = script.Parent.Parent:WaitForChild("SkinsButton"):WaitForChild("Open")
- local inf = TweenInfo.new(0.5,Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
- local Open = TS:Create(script.Parent, inf, {Position = UDim2.new(0.5 , 0, 0.5, 0)})
- local Close = TS:Create(script.Parent, inf, {Position = UDim2.new(0.5, 0, 1.4, 0)})
- local RankValue = require(game:GetService("ReplicatedStorage"):WaitForChild("RankValue"))
- CloseButton.Activated:Connect(function()open.Value=not open.Value end)
- open.Changed:Connect(function(val)
- if val then
- Open:Play()
- else
- Close:Play()
- end
- end)
- local Bar = script.Parent:WaitForChild("Bar")
- local currentPg = Bar:WaitForChild("CurrentPage")
- local Pages = script.Parent:WaitForChild("ScrollingFrame")
- local buttons = {}
- wait()
- for _,v in next,script.Parent.ScrollingFrame:GetDescendants()do
- if v:IsA('TextButton')then
- local Division=v:FindFirstChild("Division")
- local MinRank=v:FindFirstChild("MinRank")
- if (Division and not game.Players.LocalPlayer:IsInGroup(Division.Value))or(MinRank and RankValue.CompareTo(game.Players.LocalPlayer:GetRoleInGroup(5430366), MinRank.Value)<0)then
- v:Destroy()
- else
- local ViewPort=v:WaitForChild("ViewportFrame")
- local morph=ViewPort:FindFirstChildWhichIsA("Model")
- local Bar=v:WaitForChild("TextLabel")
- local GFX=Bar:WaitForChild("UIGradient")
- local Cam=Instance.new("Camera")
- local currentPg=script.Parent:WaitForChild("Bar").CurrentPage
- local bindingName=v.Name .. v.Parent.Name
- Cam.CFrame = morph:GetPrimaryPartCFrame() * CFrame.Angles(0, math.pi, 0)
- Cam.CFrame = Cam.CFrame - Cam.CFrame.LookVector * 5.5
- ViewPort.CurrentCamera = Cam
- local function rotate()
- morph:SetPrimaryPartCFrame(morph:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, math.rad(-1), 0))
- end
- v.Activated:Connect(function()
- game:GetService("ReplicatedStorage").ChangeMesh:FireServer(morph.Name)
- open.Value=not open.Value
- end)
- v.MouseEnter:Connect(function()
- TS:Create(GFX, inf, {Offset = Vector2.new(0, -1)}):Play()
- end)
- v.MouseLeave:Connect(function()
- TS:Create(GFX, inf, {Offset = Vector2.new(0, 0)}):Play()
- end)
- open.Changed:Connect(function(val)
- if val and currentPg.Value.Name == v.Parent.Name then
- Cam.CFrame = morph:GetPrimaryPartCFrame() * CFrame.Angles(0, math.pi, 0)
- Cam.CFrame = Cam.CFrame - Cam.CFrame.LookVector * 5.5
- local success, message = pcall(function() RS:UnbindFromRenderStep(bindingName) end)
- RS:BindToRenderStep(bindingName, Enum.RenderPriority.Camera.Value, rotate)
- end
- end)
- currentPg.Changed:Connect(function(pg)
- if pg == currentPg.Parent:FindFirstChild(v.Parent.Name) then
- RS:BindToRenderStep(bindingName, Enum.RenderPriority.Camera.Value, rotate)
- else
- RS:UnbindFromRenderStep(bindingName)
- Cam.CFrame = morph:GetPrimaryPartCFrame() * CFrame.Angles(0, math.pi, 0)
- Cam.CFrame = Cam.CFrame - Cam.CFrame.LookVector * 5.5
- end
- end)
- end
- end
- end
- for _, v in pairs(Bar:GetChildren()) do -- checks bind between buttons and pages
- local page = Pages:FindFirstChild(v.Name)
- if page then
- if #page:GetChildren() > 0 then
- table.insert(buttons, v)
- else
- page:Destroy()
- v:Destroy()
- end
- end
- end
- Frame.CanvasSize = UDim2.new(#buttons, 0, 0, 0)
- table.sort(buttons, function(b1, b2)return b2.order.Value > b1.order.Value end)
- for i, v in pairs(buttons) do
- v.Size = UDim2.new(1/#buttons, 0, 1, 0)
- v.Position = UDim2.new((i-1)/#buttons, 0, 0, 0)
- local page = Pages:FindFirstChild(v.Name)
- page.Size = UDim2.new(1/#buttons, 0, 1, 0)
- page.Position = UDim2.new((i-1)/#buttons, 0, 0, 0)
- local GFX = v.UIGradient
- local Darken = TS:Create(GFX, inf, {Offset = Vector2.new(0, 1)})
- local unDarken = TS:Create(GFX, inf, {Offset = Vector2.new(0, 0)})
- local Hover = TS:Create(v, inf, {BackgroundTransparency = 0})
- local deHover = TS:Create(v, inf, {BackgroundTransparency = 0.25})
- v.MouseEnter:Connect(function()
- Hover:Play()
- Darken:Play()
- end)
- v.MouseLeave:Connect(function()
- if currentPg.Value ~= v then
- deHover:Play()
- unDarken:Play()
- end
- end)
- v.Activated:Connect(function()
- currentPg.Value = v
- end)
- currentPg.Changed:Connect(function(val)
- if val == v then
- Hover:Play()
- Darken:Play()
- TS:Create(Frame, inf, {CanvasPosition = Vector2.new((i-1) * Frame.AbsoluteSize.X, (i-1) * Frame.AbsoluteSize.Y)}):Play()
- else
- deHover:Play()
- unDarken:Play()
- end
- end)
- end
- wait()
- currentPg.Value = buttons[1]
Add Comment
Please, Sign In to add comment