Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------
- -- Constants --
- ---------------
- local LegionsFrame = script.Parent.Parent.Legions
- local UniformsFrame = script.Parent.Parent.Uniforms
- local MorphsDir = game.ReplicatedStorage.Morphs
- local Libs = game.ReplicatedStorage.Libs
- local Divisions = require(Libs.Divisions)
- local Camera = game.Workspace.CurrentCamera
- local Player = game.Players.LocalPlayer
- local DevTrooper = script.DevTrooper:Clone()
- ----------
- -- Init --
- ----------
- repeat wait() until Player.Character
- script.Parent.Parent.Enabled = true
- ---------------
- -- Functions --
- ---------------
- function GiveHelmet(Helmet, BodyPart)
- local HelmetClone = Helmet:Clone()
- HelmetClone.PrimaryPart = HelmetClone.Middle
- HelmetClone:SetPrimaryPartCFrame(DevTrooper[BodyPart].CFrame)
- HelmetClone.Parent = DevTrooper
- DevTrooper.Head:ClearAllChildren()
- DevTrooper.Head.Transparency = 1
- for i,v in pairs (HelmetClone:GetChildren())do
- DevTrooper.Humanoid:RemoveAccessories()
- local W = Instance.new("Weld")
- W.Part0 = HelmetClone.Middle
- W.Part1 = v
- local CJ = CFrame.new(HelmetClone.Middle.Position)
- local C0 = HelmetClone.Middle.CFrame:inverse()*CJ
- local C1 = v.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = HelmetClone.Middle
- end
- local W2 = Instance.new("Weld")
- W2.Part0 = DevTrooper[BodyPart]
- W2.Part1 = HelmetClone.Middle
- W2.Parent = DevTrooper[BodyPart]
- for i,v in pairs (HelmetClone:GetChildren())do
- v.Anchored = false
- v.CanCollide= false
- end
- if DevTrooper:FindFirstChild("Shirt") then
- DevTrooper.Shirt:Destroy()
- end
- if DevTrooper:FindFirstChild("Pants") then
- DevTrooper.Pants:Destroy()
- end
- Helmet.Parent.Shirt:Clone().Parent = DevTrooper
- Helmet.Parent.Pants:Clone().Parent = DevTrooper
- end
- function RemoveObjects()
- if DevTrooper:FindFirstChild("Helmet") then
- DevTrooper:FindFirstChild("Helmet"):Destroy()
- end
- if DevTrooper:FindFirstChild("Arm1") then
- DevTrooper:FindFirstChild("Arm1"):Destroy()
- end
- if DevTrooper:FindFirstChild("Arm2") then
- DevTrooper:FindFirstChild("Arm2"):Destroy()
- end
- if DevTrooper:FindFirstChild("Leg1") then
- DevTrooper:FindFirstChild("Leg1"):Destroy()
- end
- if DevTrooper:FindFirstChild("Leg2") then
- DevTrooper:FindFirstChild("Leg2"):Destroy()
- end
- if DevTrooper:FindFirstChild("Chest") then
- DevTrooper:FindFirstChild("Chest"):Destroy()
- end
- end
- ----------
- -- Main --
- ----------
- function RepublicTeam()
- script.Parent.Parent.TeamSelect.Visible = false
- LegionsFrame.Visible = true
- UniformsFrame.Visible = true
- Camera.CameraType = "Scriptable"
- Camera.CFrame = game.Workspace.CamPart.CFrame
- DevTrooper.PrimaryPart = DevTrooper.Torso
- DevTrooper:SetPrimaryPartCFrame(game.Workspace.DevTrooperSpot.CFrame)
- DevTrooper.Parent = game.Workspace
- for i = 1, #Divisions do
- if Player:IsInGroup(Divisions[i].GroupId)or Divisions[i].GroupId == 0 then
- local Button = Instance.new("TextButton")
- Button.Size = UDim2.new(1,0,0,50)
- Button.BackgroundTransparency = 1
- Button.Font = "SourceSans"
- Button.TextSize = 30
- Button.TextXAlignment = "Left"
- Button.TextColor3 = Color3.fromRGB(255,255,255)
- Button.Text = Divisions[i].Name
- Button.Parent = LegionsFrame
- Button.MouseButton1Click:connect(function ()
- for i,v2 in pairs(UniformsFrame:GetChildren()) do
- if v2.ClassName == "TextButton" then
- v2:Destroy()
- end
- end
- for i,v3 in pairs (MorphsDir[Divisions[i].Name]:GetChildren()) do
- local Allowed = true
- if v3:FindFirstChild("Rank") then
- if Player:GetRankInGroup(Divisions[i].GroupId) >= v3:FindFirstChild("Rank").Value then
- Allowed = true
- else
- Allowed = false
- end
- end
- if Allowed then
- local Button2 = Instance.new("TextButton")
- Button2.Size = UDim2.new(1,0,0,50)
- Button2.BackgroundTransparency = 1
- Button2.Font = "SourceSans"
- Button2.TextSize = 30
- Button2.TextXAlignment = "Left"
- Button2.TextColor3 = Color3.fromRGB(255,255,255)
- Button2.Text = v3.Name
- Button2.Parent = UniformsFrame
- Button2.MouseButton1Click:connect(function ()
- RemoveObjects()
- if v3:FindFirstChild("Leg1") then
- GiveHelmet(v3.Leg1, "Left Leg")
- end
- if v3:FindFirstChild("Leg2") then
- GiveHelmet(v3.Leg2, "Right Leg")
- end
- if v3:FindFirstChild("Arm1") then
- GiveHelmet(v3.Arm1, "Left Arm")
- end
- if v3:FindFirstChild("Arm2") then
- GiveHelmet(v3.Arm2, "Right Arm")
- end
- if v3:FindFirstChild("Chest") then
- GiveHelmet(v3.Chest, "Torso")
- end
- if v3:FindFirstChild("Helmet") then
- GiveHelmet(v3.Helmet, "Head")
- end
- SelectedMorph = v3
- script.Parent.Parent.Spawn.Visible = true
- end)
- end
- end
- end)
- end
- end
- end
- function RaiderTeam()
- script.Parent.Parent.TeamSelect.Visible = false
- LegionsFrame.Visible = false
- UniformsFrame.Visible = false
- Player.Character.Torso.CFrame = game.Workspace.RaiderSpawn.CFrame
- end
- script.Parent.Parent.TeamSelect.Republic.MouseButton1Click:connect(function ()
- if Player:IsInGroup(Divisions.MainGroup) then
- RepublicTeam()
- else
- script.Parent.Parent.TeamSelect.Republic.TextLabel.Text = "You are not in the group!"
- wait(2)
- script.Parent.Parent.TeamSelect.Republic.TextLabel.Text = "REPUBLIC"
- end
- end)
- script.Parent.Parent.TeamSelect.Hostiles.MouseButton1Click:connect(function ()
- if Player:IsInGroup(Divisions.MainGroup) then
- script.Parent.Parent.TeamSelect.Hostiles.TextLabel.Text = "You are in the clone group!"
- wait(2)
- script.Parent.Parent.TeamSelect.Hostiles.TextLabel.Text = "CIS"
- else
- RaiderTeam()
- end
- end)
- script.Parent.Parent.Spawn.MouseButton1Click:connect(function ()
- game.ReplicatedStorage.MorphEvent:FireServer(SelectedMorph)
- Camera.CameraType = "Custom"
- script.Parent.Parent.Enabled = false
- Player.Character.Torso.CFrame = game.Workspace.FriendSpawn.CFrame
- DevTrooper:Destroy()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement