View difference between Paste ID: LURBqLde and 57LhKixG
SHOW: | | - or go back to the newest paste.
1
local function QuaternionFromCFrame(cf)
2
                local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
3
                local trace = m00 + m11 + m22
4
                if trace > 0 then
5
                        local s = math.sqrt(1 + trace)
6
                        local recip = 0.5/s
7
                        return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
8
                else
9
                        local i = 0
10
                        if m11 > m00 then
11
                                i = 1
12
                        end
13
                        if m22 > (i == 0 and m00 or m11) then
14
                                i = 2
15
                        end
16
                        if i == 0 then
17
                                local s = math.sqrt(m00-m11-m22+1)
18
                                local recip = 0.5/s
19
                                return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
20
                        elseif i == 1 then
21
                                local s = math.sqrt(m11-m22-m00+1)
22
                                local recip = 0.5/s
23
                                return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
24
                        elseif i == 2 then
25
                                local s = math.sqrt(m22-m00-m11+1)
26
                                local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
27
                        end
28
                end
29
        end
30
        local function QuaternionToCFrame(px, py, pz, x, y, z, w)
31
                local xs, ys, zs = x + x, y + y, z + z
32
                local wx, wy, wz = w*xs, w*ys, w*zs
33
                local xx = x*xs
34
                local xy = x*ys
35
                local xz = x*zs
36
                local yy = y*ys
37
                local yz = y*zs
38
                local zz = z*zs
39
                return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
40
                end  
41
        local function QuaternionSlerp(a, b, t)
42
                local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
43
                local startInterp, finishInterp;
44
                if cosTheta >= 0.0001 then
45
                        if (1 - cosTheta) > 0.0001 then
46
                                local theta = math.acos(cosTheta)
47
                                local invSinTheta = 1/math.sin(theta)
48
                                startInterp = math.sin((1-t)*theta)*invSinTheta
49
                                finishInterp = math.sin(t*theta)*invSinTheta  
50
                        else
51
                                startInterp = 1-t
52
                                finishInterp = t
53
                        end
54
                else
55
                        if (1+cosTheta) > 0.0001 then
56
                                local theta = math.acos(-cosTheta)
57
                                local invSinTheta = 1/math.sin(theta)
58
                                startInterp = math.sin((t-1)*theta)*invSinTheta
59
                                finishInterp = math.sin(t*theta)*invSinTheta
60
                        else
61
                                startInterp = t-1
62
                                finishInterp = t
63
                        end
64
                end
65
                return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
66
        end  
67
        function clerp(a,b,t)
68
                local qa = {QuaternionFromCFrame(a)}
69
                local qb = {QuaternionFromCFrame(b)}
70
                local ax, ay, az = a.x, a.y, a.z
71
                local bx, by, bz = b.x, b.y, b.z  
72
                local _t = 1-t
73
                return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
74
        end
75
 
76
do --the animating
77
plr = game:service'Players'.LocalPlayer
78
char = plr.Character
79
mouse = plr:GetMouse()
80
humanoid = char:findFirstChild("Humanoid")
81
torso = char:findFirstChild("Torso")
82
head = char.Head
83
ra = char:findFirstChild("Right Arm")
84
la = char:findFirstChild("Left Arm")
85
rl = char:findFirstChild("Right Leg")
86
ll = char:findFirstChild("Left Leg")
87
rs = torso:findFirstChild("Right Shoulder")
88
ls = torso:findFirstChild("Left Shoulder")
89
rh = torso:findFirstChild("Right Hip")
90
lh = torso:findFirstChild("Left Hip")
91
neck = torso:findFirstChild("Neck")
92
rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
93
anim = char:findFirstChild("Animate")
94
rootpart = char:findFirstChild("HumanoidRootPart")
95
camera = workspace.CurrentCamera
96
if anim then
97
anim:Destroy()
98
end
99
 
100
 
101
local rm = Instance.new("Motor", torso)
102
rm.C0 = CFrame.new(1.5, 0.5, 0)
103
rm.C1 = CFrame.new(0, 0.5, 0)
104
rm.Part0 = torso
105
rm.Part1 = ra
106
local lm = Instance.new("Motor", torso)
107
lm.C0 = CFrame.new(-1.5, 0.5, 0)
108
lm.C1 = CFrame.new(0, 0.5, 0)
109
lm.Part0 = torso
110
lm.Part1 = la
111
 
112
local rlegm = Instance.new("Motor", torso)
113
rlegm.C0 = CFrame.new(0.5, -1, 0)
114
rlegm.C1 = CFrame.new(0, 1, 0)
115
rlegm.Part0 = torso
116
rlegm.Part1 = rl
117
local llegm = Instance.new("Motor", torso)
118
llegm.C0 = CFrame.new(-0.5, -1, 0)
119
llegm.C1 = CFrame.new(0, 1, 0)
120
llegm.Part0 = torso
121
llegm.Part1 = ll
122
 
123
neck.C0 = CFrame.new(0, 1, 0)
124
neck.C1 = CFrame.new(0, -0.5, 0)
125
 
126
 
127
rj.C0 = CFrame.new()
128
rj.C1 = CFrame.new()
129
 
130
 
131
local sound = Instance.new("Sound", head)
132
sound.SoundId = "http://www.roblox.com/asset/?id=130797915"
133
sound.Volume = 0.8
134
sound.Looped = true
135
 
136
for i,v in pairs(char:children()) do
137
    if v:IsA("Hat") then
138
        v:Destroy()
139
    end
140
end
141
 
142
 
143
--look of the fox here
144
game:service'InsertService':LoadAsset(151784320):children()[1].Parent = char
145
Instance.new("PointLight", head).Range = 10
146
 
147
print'sweg, madiik made dis kthx' --ogm y found meh sekret
148
 
149
 
150
local speed = 0.3
151
local angle = 0
152
local sitting = false
153
local humanwalk = false
154
local anglespeed = 1
155
rsc0 = rm.C0
156
lsc0 = lm.C0
157
llc0 = llegm.C0
158
rlc0 = rlegm.C0
159
neckc0 = neck.C0
160
 
161
local controllerService = game:GetService("ControllerService")
162
local controller = controllerService:GetChildren()[1]
163
 
164
controller.Parent = nil
165
 
166
Instance.new("HumanoidController", game:service'ControllerService')
167
Instance.new("SkateboardController", game:service'ControllerService')
168
Instance.new("VehicleController", game:service'ControllerService')
169
local controller = controllerService:GetChildren()[1]
170
mouse.KeyDown:connect(function(k)
171
    if k == "q" then
172
        humanwalk = not humanwalk
173
    end
174
    if k == "z" then
175
        if not sound.IsPlaying then
176
            sound:stop()
177
            sound.SoundId = "http://www.roblox.com/asset/?id=130802245"
178
            wait()
179
            sound:play()
180
        end
181
    end
182
    if k == "x" then
183
        if not sound.IsPlaying then
184
            sound:stop()
185
            sound.SoundId = "http://www.roblox.com/asset/?id=130797915"
186
            wait()
187
            sound:play()
188
        end
189
    end
190
    if k == "c" then
191
        if not sound.IsPlaying then
192
            sound:stop()
193
            sound.SoundId = "http://www.roblox.com/asset/?id=149713968"
194
            wait()
195
            sound:play()
196
        end
197
    end
198
    if string.byte(k) == 48 then
199
        humanoid.WalkSpeed = 34
200
    end
201
   
202
end)
203
mouse.KeyUp:connect(function(k)
204
   
205
    if string.byte(k) == 48 then
206
        humanoid.WalkSpeed = 16
207
    end
208
   
209
end)
210
 
211
   
212
 
213
while wait() do
214
    angle = (angle % 100) + anglespeed/10
215
        mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
216
        local rscf = rsc0
217
        local lscf = lsc0
218
        local rlcf = rlc0
219
        local llcf = llc0
220
        local rjcf = CFrame.new()
221
        local ncf = neckc0
222
        local rayz = Ray.new(rootpart.Position, Vector3.new(0, -6, 0))
223
            local hitz, enz = workspace:findPartOnRay(rayz, char)
224
            if not hitz then
225
        if sound.IsPlaying then
226
            sound:stop()
227
        end
228
       
229
        if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude > 2 then
230
       
231
        ncf = neckc0 * CFrame.Angles(math.pi/5, 0, 0)
232
        rjcf = CFrame.new() * CFrame.Angles(-math.pi/5, math.sin(angle)*0.05, 0)
233
        rscf = rsc0 * CFrame.Angles(math.pi/1.7+math.sin(angle)*0.1, 0, 0)
234
        lscf = lsc0 * CFrame.Angles(math.pi/1.7+math.sin(-angle)*0.1, 0, 0)
235
        rlcf = rlc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.3, 0, 0)
236
        llcf = llc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.3, 0, 0)
237
       
238
        else
239
       
240
        ncf = neckc0 * CFrame.Angles(math.pi/14, 0, 0)
241
        rjcf = CFrame.new() * CFrame.Angles(-math.pi/18, math.sin(angle)*0.05, 0)
242
        rscf = rsc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.2, 0, 0)
243
        lscf = lsc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.2, 0, 0)
244
        rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) CFrame.Angles(-math.pi/14, 0, 0)
245
        llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0)
246
       
247
        end
248
    elseif humanoid.Sit then
249
        if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then
250
        anglespeed = 6
251
        ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
252
        rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
253
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
254
        lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
255
        rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
256
        llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
257
        elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=135570347" then
258
        anglespeed = 4
259
        ncf = neckc0 * CFrame.Angles(math.pi/5-math.abs(math.sin(angle))*0.3, 0, 0)
260
        rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
261
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
262
        lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
263
        rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
264
        llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
265
        elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then
266
        anglespeed = 2
267
        ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
268
        rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
269
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
270
        lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
271
        rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
272
        llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
273
        else
274
        anglespeed = 1/2
275
        ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
276
        rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
277
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
278
        lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
279
        rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
280
        llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
281
        end
282
    elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
283
        if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then
284
        anglespeed = 6
285
            ncf = neckc0 * CFrame.Angles(math.pi/10-math.sin(angle)*0.07, 0, 0)
286
            rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/10, math.sin(angle)*0.001, 0)
287
            rscf = rsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0)
288
            lscf = lsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0)
289
            rlcf = rlc0 * CFrame.Angles(math.pi/10, math.sin(angle)*0.08, math.rad(6.5))
290
            llcf = llc0 * CFrame.Angles(math.pi/10, -math.sin(angle)*0.08, -math.rad(6.5))
291
        elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then
292
            anglespeed = 2
293
            ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3, 0, 0)
294
            rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/20, math.sin(angle)*0.001, 0)
295
            rscf = rsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0)
296
            lscf = lsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0)
297
            rlcf = rlc0 * CFrame.Angles(math.pi/20, math.sin(angle)*0.08, math.rad(2.5))
298
            llcf = llc0 * CFrame.Angles(math.pi/20, -math.sin(angle)*0.08, -math.rad(2.5))
299
        elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130802245" then
300
        anglespeed = 3
301
        ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.07, math.rad(30), 0)
302
        rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
303
        rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.05, 0, 0)
304
        lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.05, 0, 0)
305
        rlcf = rlc0 * CFrame.new(0, -0.1 + math.abs(mvmnt)*0.1, -0.1) * CFrame.Angles(0, math.rad(5), math.rad(5))
306
        llcf = llc0 * CFrame.Angles(0, math.rad(2.5), math.rad(1))
307
        else
308
            if humanwalk then
309
                        anglespeed = 1/4
310
        ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
311
        rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
312
        rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.1, 0, 0)
313
        lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.1, 0, 0)
314
        rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5))
315
        llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5))
316
                else
317
        anglespeed = 1/2
318
        ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
319
        rjcf = CFrame.new(0, -2, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
320
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
321
        lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
322
        rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
323
        llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
324
            end
325
        end
326
    elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 20 then
327
        if sound.IsPlaying then
328
            sound:stop()
329
        end
330
        if humanwalk then
331
                                anglespeed = 4
332
        ncf = neckc0 * CFrame.Angles(math.pi/24, mvmnt*.02, 0)
333
        rjcf = CFrame.new(0, math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/24, -mvmnt*.02, 0)
334
        rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.25, 0, -math.abs(mvmnt)*0.02)
335
        lscf = lsc0 * CFrame.Angles(math.sin(-angle)*1.25, 0, math.abs(mvmnt)*0.02)
336
        rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*1, 0, math.rad(.5))
337
        llcf = llc0 * CFrame.Angles(math.sin(angle)*1, 0, -math.rad(.5))
338
                else
339
        anglespeed = 4
340
        ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9, 0, 0)
341
        rjcf = CFrame.new(0, -1.5+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9, math.sin(mvmnt/2)*0.05, 0)
342
        rscf = rsc0 * CFrame.new(-.45, 0.2, -.4+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(angle)*0.7, 0, math.rad(5))
343
        lscf = lsc0 * CFrame.new(.45, 0.2, .1-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(-angle)*0.7, 0, -math.rad(5))
344
        rlcf = rlc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*0.6, 0, math.abs(mvmnt)*0.025)
345
        llcf = llc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(angle)*.6, 0, -math.abs(mvmnt)*0.025)
346
        end
347
    elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then
348
        if sound.IsPlaying then
349
            sound:stop()
350
        end
351
        if humanwalk then
352
        anglespeed = 5
353
        ncf = neckc0 * CFrame.Angles(math.pi/20, math.sin(angle)*.04, 0)
354
        rjcf = CFrame.new(0, -.4 + math.abs(mvmnt)*0.25, 0) * CFrame.Angles(-math.pi/20, -math.sin(angle)*.08, 0)
355
        rscf = rsc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) *  CFrame.Angles(math.pi/18+math.sin(angle)*1.5, 0, -math.abs(mvmnt)*0.02)
356
        lscf = lsc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(-angle)*1.5, 0, math.abs(mvmnt)*0.02)
357
        rlcf = rlc0 * CFrame.new(0, 0, -.6+math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5))
358
        llcf = llc0 * CFrame.new(0, 0, -math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5))
359
        else
360
        anglespeed = 5.5
361
        ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9+math.sin(mvmnt/2)*0.05, 0, 0)
362
        rjcf = CFrame.new(0, -1.3+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9+math.abs(mvmnt/2)*0.1, 0, 0)
363
        rscf = rsc0 * CFrame.new(-1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, math.rad(5))
364
        lscf = lsc0 * CFrame.new(1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, -math.rad(5))
365
        rlcf = rlc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, math.abs(mvmnt)*0.025)
366
        llcf = llc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, -math.abs(mvmnt)*0.025)
367
        end
368
    end
369
       
370
    rm.C0 = clerp(rm.C0,rscf,speed)
371
    lm.C0 = clerp(lm.C0,lscf,speed)
372
    rj.C0 = clerp(rj.C0,rjcf,speed)
373
    neck.C0 = clerp(neck.C0,ncf,speed)
374
    rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
375
    llegm.C0 = clerp(llegm.C0,llcf,speed)
376
end
377
 
378
 
379
end