Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = game.Players.LocalPlayer
- 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 = script.AlignPosition:Clone()
- ap.Attachment0 = att0
- ap.Attachment1 = att1
- local ball = script.Ball:Clone()
- 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
- game:GetService("ReplicatedStorage").RemoteEvent:FireServer("GrappleFinished")
- end
- return grapple
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement