Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --HumanoidDescription--
- local Birthday = Instance.new("HumanoidDescription")
- Birthday.Face = 1428416217
- Birthday.HeadColor = Color3.new(211,190,150)
- Birthday.LeftArmColor = Color3.new(245,205,49)
- Birthday.RightArmColor = Color3.new(245,205,49)
- Birthday.LeftLegColor = Color3.new(164,189,71)
- Birthday.RightLegColor = Color3.new(164,189,71)
- Birthday.TorsoColor = Color3.new(167,94,155)
- --Services--
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ServerStorage = game:GetService("ServerStorage")
- local Players = game:GetService('Players')
- --Variables--
- local Throw = ReplicatedStorage:WaitForChild("Throw")
- local Select = ReplicatedStorage:WaitForChild("Select")
- --local changeAppearance = ReplicatedStorage:WaitForChild('changeAppearance')
- local HatFolder = ServerStorage.Hats
- local HitboxFolder = ServerStorage.Hitboxes
- --Script--
- Select.OnServerEvent:Connect(function(player, hatName)
- local character = player.Character
- local hat = HatFolder:FindFirstChild(hatName)
- if hat then
- player.Character.Humanoid:ApplyDescription(Birthday) --Change Their Avatar To The Selected Character
- --[[
- if hat.Name == "Cole" then
- local Hitbox = HitboxFolder:FindFirstChild("HitboxBig")
- local clonedHitbox = Hitbox:Clone()
- clonedHitbox.CFrame = character.HumanoidRootPart.CFrame
- Hitbox.Name = "Hitbox"
- local hitboxWeld = Instance.new("WeldConstraint")
- hitboxWeld.Part0 = clonedHitbox
- hitboxWeld.Part1 = character.HumanoidRootPart
- hitboxWeld.Parent = clonedHitbox
- clonedHitbox.Parent = character
- elseif hat.Name == "CaptainHat" then
- local Hitbox = HitboxFolder:FindFirstChild("HitboxSmall")
- local clonedHitbox = Hitbox:Clone()
- clonedHitbox.CFrame = character.HumanoidRootPart.CFrame
- Hitbox.Name = "Hitbox"
- local hitboxWeld = Instance.new("WeldConstraint")
- hitboxWeld.Part0 = clonedHitbox
- hitboxWeld.Part1 = character.HumanoidRootPart
- hitboxWeld.Parent = clonedHitbox
- clonedHitbox.Parent = character
- else
- local Hitbox = HitboxFolder:FindFirstChild("HitboxNormal")
- local clonedHitbox = Hitbox:Clone()
- clonedHitbox.CFrame = character.HumanoidRootPart.CFrame
- Hitbox.Name = "Hitbox"
- local hitboxWeld = Instance.new("WeldConstraint")
- hitboxWeld.Part0 = clonedHitbox
- hitboxWeld.Part1 = character.HumanoidRootPart
- hitboxWeld.Parent = clonedHitbox
- clonedHitbox.Parent = character
- end
- --]]
- local chosenHat = HatFolder:FindFirstChild(hat.Name)
- local clonedHat = chosenHat:Clone()
- clonedHat.Name = "Hat"
- local head = character:WaitForChild("Head")
- clonedHat.CFrame = head.CFrame * CFrame.new(0,1.5,0)
- clonedHat.Parent = character
- --Weld The Hat To The Players Head
- local weld = Instance.new("WeldConstraint")
- weld.Name = "Weld"
- weld.Part0 = clonedHat
- weld.Part1 = head
- weld.Parent = clonedHat
- --Picking The Hat Up--
- clonedHat.Touched:Connect(function(hit)
- if hit.Name == "Left Leg" or hit.Name == "Right Leg" then
- if hit:IsDescendantOf(character) then
- weld.Parent = clonedHat
- elseif not hit:IsDescendantOf(character) then
- local opponent = Players:GetPlayerFromCharacter(hit.Parent)
- character:BreakJoints()
- wait(5)
- opponent.leaderstats.Points.Value = opponent.leaderstats.Points.Value + 1
- end
- end
- end)
- end
- end)
- --Throwing The Hat--
- Throw.OnServerEvent:Connect(function(player, mouse)
- local character = player.Character
- local clonedHat = character:FindFirstChild("Hat")
- local weld = clonedHat:FindFirstChild("Weld")
- local trail = Instance.new("Trail")
- local att0 = Instance.new("Attachment")
- local att1 = Instance.new("Attachment")
- if weld then
- weld.Parent = nil
- local bodyVelocity = Instance.new("BodyVelocity")
- --Moving The Hat Forward--
- bodyVelocity.MaxForce = Vector3.new(200,200,200)
- bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.lookVector*25)
- --bodyVelocity.Velocity = mouse.p
- bodyVelocity.Parent = character:FindFirstChild("Hat")
- --Trail Effect On Hat--
- trail.Parent = clonedHat
- att0.Parent = clonedHat
- att1.Parent = clonedHat
- trail.Attachment0 = att0
- trail.Attachment1 = att1
- trail.Enabled = true
- att0.Position = Vector3.new(.5,0,0)
- att1.Position = Vector3.new(-.5,0,0)
- local touchConn
- touchConn = clonedHat.Touched:Connect(function(hit)
- if hit.Parent:FindFirstChild("Humanoid") then
- if hit.Parent.Name ~= player.Name then
- hit.Parent:FindFirstChild("Hat").Weld.Parent = nil
- end
- end
- end)
- wait(3)
- bodyVelocity:Destroy()
- trail.Enabled = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment