View difference between Paste ID: S0G13r7D and wCB84Hsx
SHOW: | | - or go back to the newest paste.
1
--[[
2
		CoreEffectsHandler [XeverCaiver]
3
		
4
		BaseCoreEffectsHandler
5
		
6
		Leaning
7
		CloudParticles
8
--]]
9
local Player = game.Players.LocalPlayer
10
11
-- Services
12
local CollectionService = game:GetService("CollectionService")
13
local TweenService = game:GetService("TweenService")
14
local RunService = game:GetService("RunService")
15
local Players = game:GetService("Players")
16
17
local RenderDistance = 500
18
19
local CoreEffectsEvent
20
local Smoothness = 12
21
22
local NotAffected = {}
23
CoreEffectsEvent = RunService.Stepped:Connect(function(Time, Step)
24
	for Index, Character in pairs(CollectionService:GetTagged("OnEffect")) do
25
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
26
		
27
		if (HumanoidRootPart) then
28
			if (Player:DistanceFromCharacter(HumanoidRootPart.Position) <= RenderDistance) then
29
				local Torso = Character:FindFirstChild("Torso")
30
				
31
				if (Torso) then
32
					local RootHip = HumanoidRootPart:FindFirstChild("RootJoint")
33
					
34
					local RightHip = Torso:FindFirstChild("Right Hip")
35
					local LeftHip = Torso:FindFirstChild("Left Hip")
36
					local Neck = Torso:FindFirstChild("Neck")
37
					
38
					print(RootHip, RightHip, LeftHip, Neck, Torso)
39
					if (RootHip and RightHip and LeftHip and Neck) then
40
						local Dot = HumanoidRootPart.Velocity:Dot(HumanoidRootPart.CFrame.RightVector)
41
						--print(Dot)
42
						
43
						RootHip.C0 = RootHip.C0:lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(0, -math.rad(math.clamp(Dot * 4, -12, 12)), 0), 1*Step*Smoothness)
44
						
45
						LeftHip.C0 = LeftHip.C0:lerp(CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) * CFrame.Angles(math.rad(math.clamp(Dot * 2, -8, 8)), 0, 0), 1*Step*Smoothness)
46
						RightHip.C0 = RightHip.C0:lerp(CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08) * CFrame.Angles(-math.rad(math.clamp(Dot * 2, -8, 8)), 0, 0), 1*Step*Smoothness)
47
					end
48
				end
49
			end
50
		end
51
	end
52
end)
53
54
function AddTag(Player)
55
	if Player.Character then
56
		CollectionService:AddTag(Player.Character, "OnEffect")
57
	end
58
	
59
	Player.CharacterAdded:Connect(function(Character)
60
		CollectionService:AddTag(Character, "OnEffect")
61
	end)
62
end
63
64
for Index, Player in pairs(Players:GetPlayers()) do AddTag(Player) end
65
Players.PlayerAdded:Connect(AddTag)