View difference between Paste ID: zRc5sdis and hgZmqu3u
SHOW: | | - or go back to the newest paste.
1
local Player = game.Players.LocalPlayer
2
local Character = Player.Character or Player.CharacterAdded:Wait()
3
local Mouse = Player:GetMouse()
4
local Camera = workspace.CurrentCamera
5
6
--// Services
7
local ReplicatedStorage = game:GetService('ReplicatedStorage')
8
local UIS = game:GetService('UserInputService')
9
local RunService = game:GetService('RunService')
10
11
--// Main
12
local Humanoid = Character:FindFirstChild('Humanoid')
13
if Humanoid then
14
	Humanoid.JumpPower = 100
15
	Humanoid.WalkSpeed = 20
16
end
17
18
local Clicked = false
19
Mouse.Button1Down:Connect(function()
20
	if Clicked == false and Mouse.Target ~= nil and Character:FindFirstChild('LeftHand') then
21
		Clicked = true
22
		local Pos = Mouse.Hit.p
23
		
24
		--// I have this commented out if you want an animation. (Might be glitchy!)
25
--		local Anim = Instance.new('Animation',Character)
26
--		Anim.AnimationId = 'rbxassetid://769730840'
27
--		PlayAnim = Character:WaitForChild('Humanoid'):LoadAnimation(Anim)
28
--		PlayAnim:Play()
29
		
30
		if Character:FindFirstChild('HumanoidRootPart') then
31
			local Sound = Instance.new('Sound',Character.HumanoidRootPart)
32
			Sound.SoundId = 'rbxassetid://231731980' -- Web sound, you may change this sound id if you want ;)
33
			Sound:Play()
34
		end
35
		
36
		Part = Instance.new('Part',workspace)
37
		Part.Size = Vector3.new(1,1,1)
38
		Part.Transparency = 1
39
		Part.Anchored = true
40
		Part.CanCollide = false
41
		Part.CFrame = CFrame.new(Pos)
42
		
43
		local Att0 = Instance.new('Attachment',Player.Character.LeftHand)
44
		local Att1 = Instance.new('Attachment',Part)
45
		
46
		Rope = Instance.new('RopeConstraint',Player.Character.LeftHand)
47
		Rope.Color = BrickColor.new('Institutional white')
48
		Rope.Visible = true
49
		Rope.Length = (Player.Character.LeftHand.Position - Part.Position).magnitude
50
		Rope.Attachment0 = Att0
51
		Rope.Attachment1 = Att1
52
		
53
		--// Force
54
		Force = Instance.new('BodyForce',Player.Character:WaitForChild('HumanoidRootPart'))
55
		while Force ~= nil and wait() do
56
			Force.Force = Camera.CFrame.lookVector * Vector3.new(10000,0,10000) -- Force added when you swing. You may change this.
57
		end		
58
	elseif Clicked == true then
59
		Clicked = false
60
		
61
		if Rope then
62
			Rope:Destroy()
63
		end
64
		if Part then
65
			Part:Destroy()
66
		end
67
		if Force then
68
			Force:Destroy()
69
		end
70
--		if PlayAnim then -- This stop the animation
71
--			PlayAnim:Stop()
72
--		end
73
	end	
74
end)
75
76
--// Climbing Web
77
UIS.InputBegan:Connect(function(Input)
78
	if Input.KeyCode == Enum.KeyCode.Q then
79
		ClimbingWeb = false
80
		if Rope then
81
			ClimbingWeb = true
82
			while ClimbingWeb and Rope do
83
				Rope.Length = Rope.Length - 3 -- Basically, the higher the number, the faster it pulls you.
84
				RunService.RenderStepped:Wait()
85
			end
86
		end
87
	end
88
end)
89
90
UIS.InputEnded:Connect(function(Input)
91
	if Input.KeyCode == Enum.KeyCode.Q then
92
		ClimbingWeb = false
93
	end
94
end)
95
96
--// ReleaseWeb
97
UIS.InputBegan:Connect(function(Input)
98
	if Input.KeyCode == Enum.KeyCode.E then
99
		ReleaseWeb = false
100
		if Rope then
101
			ReleaseWeb = true
102
			while ReleaseWeb and Rope do
103
				Rope.Length = Rope.Length + 3 -- Same here, this is for going down though.
104
				RunService.RenderStepped:Wait()
105
			end
106
		end
107
	end
108
end)
109
110
UIS.InputEnded:Connect(function(Input)
111
	if Input.KeyCode == Enum.KeyCode.E then
112
		ReleaseWeb = false
113
	end
114
end)