Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = game.Players.LocalPlayer
- local remote = game:GetService("ReplicatedStorage").RemoteEvent
- local grapple = {}
- function grapple.New()
- local object = setmetatable({},{_index=grapple})
- return object
- end
- function grapple:Start(att1,pos)
- self:SetHipHeight(0)
- local att0 = Instance.new("Attachment")
- local ap = Instance.new("AlignPosition")
- local ball = Instance.new("Part")
- ap.Attachment0 = att0
- ap.Attachment1 = att1
- ap.ReactionForceEnabled = true
- ap.Responsiveness = 50
- ap.MaxForce = 10000
- ball.Shape = Enum.PartType.Ball
- ball.Size = Vector3.new(5,5,5)
- ball.Transparency = 1
- ball.CanCollide = false
- ball.Anchored = true
- ball.Position = pos
- self.CreatedInstances = {att0, ap, Ball = ball}
- ball.Parent = plr.Character
- att0.Parent = plr.Character.PrimaryPart
- ap.Parent = plr.Character
- end
- function grapple:SetHipHeight(num)
- local hum = plr.Character:FindFirstChild("Humanoid")
- if hum then
- self.OldHipHeight = hum.HipHeight
- hum.HipHeight = num
- end
- end
- function grapple:Stop()
- for i,v in next, self.CreatedInstances do
- v:Destroy()
- end
- self:SetHipHeight(self.OldHipHeight)
- if plr.Character.PrimaryPart then
- plr.Character.PrimaryPart.Velocity = Vector3.new(0,0,0)
- end
- remote:FireServer("GrappleFinished")
- end
- return grapple
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement