View difference between Paste ID: LL4L9HeX and JuYUtriK
SHOW: | | - or go back to the newest paste.
1
-----------------------
2
 
3
--EDIT BY LUKAS242--
4
 
5
------------------------
6
 
7
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
8
local Player,game,owner = owner,game
9
local RealPlayer = Player
10
do
11
    print("FE Compatibility code by Mokiros")
12
    local rp = RealPlayer
13
    script.Parent = rp.Character
14
   
15
    --RemoteEvent for communicating
16
    local Event = Instance.new("RemoteEvent")
17
    Event.Name = "UserInput_Event"
18
 
19
    --Fake event to make stuff like Mouse.KeyDown work
20
    local function fakeEvent()
21
        local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
22
        t.connect = t.Connect
23
        return t
24
    end
25
 
26
    --Creating fake input objects with fake variables
27
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
28
    local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
29
    local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
30
        CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
31
    end}
32
    --Merged 2 functions into one by checking amount of arguments
33
    CAS.UnbindAction = CAS.BindAction
34
 
35
    --This function will trigger the events that have been :Connect()'ed
36
    local function te(self,ev,...)
37
        local t = m[ev]
38
        if t and t._fakeEvent then
39
            for _,f in pairs(t.Functions) do
40
                f(...)
41
            end
42
        end
43
    end
44
    m.TrigEvent = te
45
    UIS.TrigEvent = te
46
 
47
    Event.OnServerEvent:Connect(function(plr,io)
48
        if plr~=rp then return end
49
        m.Target = io.Target
50
        m.Hit = io.Hit
51
        if not io.isMouse then
52
            local b = io.UserInputState == Enum.UserInputState.Begin
53
            if io.UserInputType == Enum.UserInputType.MouseButton1 then
54
                return m:TrigEvent(b and "Button1Down" or "Button1Up")
55
            end
56
            for _,t in pairs(CAS.Actions) do
57
                for _,k in pairs(t.Keys) do
58
                    if k==io.KeyCode then
59
                        t.Function(t.Name,io.UserInputState,io)
60
                    end
61
                end
62
            end
63
            m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
64
            UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
65
        end
66
    end)
67
    Event.Parent = NLS([==[
68
    local Player = owner
69
    local Event = script:WaitForChild("UserInput_Event")
70
 
71
    local Mouse = Player:GetMouse()
72
    local UIS = game:GetService("UserInputService")
73
    local input = function(io,a)
74
        if a then return end
75
        --Since InputObject is a client-side instance, we create and pass table instead
76
        Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
77
    end
78
    UIS.InputBegan:Connect(input)
79
    UIS.InputEnded:Connect(input)
80
 
81
    local h,t
82
    --Give the server mouse data 30 times every second, but only if the values changed
83
    --If player is not moving their mouse, client won't fire events
84
    while wait(1/30) do
85
        if h~=Mouse.Hit or t~=Mouse.Target then
86
            h,t=Mouse.Hit,Mouse.Target
87
            Event:FireServer({isMouse=true,Target=t,Hit=h})
88
        end
89
    end]==],Player.Character)
90
 
91
    ----Sandboxed game object that allows the usage of client-side methods and services
92
    --Real game object
93
    local _rg = game
94
 
95
    --Metatable for fake service
96
    local fsmt = {
97
        __index = function(self,k)
98
            local s = rawget(self,"_RealService")
99
            if s then return s[k] end
100
        end,
101
        __newindex = function(self,k,v)
102
            local s = rawget(self,"_RealService")
103
            if s then s[k]=v end
104
        end,
105
        __call = function(self,...)
106
            local s = rawget(self,"_RealService")
107
            if s then return s(...) end
108
        end
109
    }
110
    local function FakeService(t,RealService)
111
        t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
112
        return setmetatable(t,fsmt)
113
    end
114
 
115
    --Fake game object
116
    local g = {
117
        GetService = function(self,s)
118
            return self[s]
119
        end,
120
        Players = FakeService({
121
            LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
122
        },"Players"),
123
        UserInputService = FakeService(UIS,"UserInputService"),
124
        ContextActionService = FakeService(CAS,"ContextActionService"),
125
    }
126
    rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
127
    g.service = g.GetService
128
   
129
    g.RunService = FakeService({
130
        RenderStepped = _rg:GetService("RunService").Heartbeat,
131
        BindToRenderStep = function(self,name,_,fun)
132
            self._btrs[name] = self.Heartbeat:Connect(fun)
133
        end,
134
        UnbindFromRenderStep = function(self,name)
135
            self._btrs[name]:Disconnect()
136
        end,
137
    },"RunService")
138
 
139
    setmetatable(g,{
140
        __index=function(self,s)
141
            return _rg:GetService(s) or typeof(_rg[s])=="function"
142
            and function(_,...)return _rg[s](_rg,...)end or _rg[s]
143
        end,
144
        __newindex = fsmt.__newindex,
145
        __call = fsmt.__call
146
    })
147
    --Changing owner to fake player object to support owner:GetMouse()
148
    game,owner = g,g.Players.LocalPlayer
149
end
150
 
151
local runDummyScript = function(f,scri)
152
local oldenv = getfenv(f)
153
local newenv = setmetatable({}, {
154
__index = function(_, k)
155
if k:lower() == 'script' then
156
return scri
157
else
158
return oldenv[k]
159
end
160
end
161
})
162
setfenv(f, newenv)
163
ypcall(function() f() end)
164
end
165
cors = {}
166
mas = Instance.new("Model",game:GetService("Lighting"))
167
mas.Name = "CompiledModel"
168
o1 = Instance.new("Tool")
169
o2 = Instance.new("Part")
170
o3 = Instance.new("SpecialMesh")
171
o4 = Instance.new("Sound")
172
o6 = Instance.new("Animation")
173
o7 = Instance.new("Script")
174
o8 = Instance.new("LocalScript")
175
o10 = Instance.new("Script")
176
o1.Name = "Rotorcycle"
177
o1.Parent = mas
178
o1.TextureId = "http://www.roblox.com/asset/?id=122306779"
179
o1.GripForward = Vector3.new(-0, 3.9340253e-007, -1)
180
o1.GripPos = Vector3.new(1.40000021, 1.96000028, -1.4000001)
181
o1.GripUp = Vector3.new(0, 1, 3.9340253e-007)
182
o1.ToolTip = "LOOK'N FOR ADVENTURE"
183
o1.CanBeDropped = false
184
o2.Name = "Handle"
185
o2.Parent = o1
186
o2.Position = Vector3.new(-7.00265312, 0.101328999, 49.6637764)
187
o2.Rotation = Vector3.new(0.00306340586, 90, 0)
188
o2.Elasticity = 0
189
o2.FormFactor = Enum.FormFactor.Custom
190
o2.Friction = 0
191
o2.Size = Vector3.new(0.200000003, 0.200000003, 7.91000128)
192
o2.CFrame = CFrame.new(-7.00265312, 0.101328999, 49.6637764, -6.97787764e-005, 0.000328140828, 1, 5.3466516e-005, 0.99999994, -0.000328137132, -1, 5.34436149e-005, -6.97963187e-005)
193
o2.BottomSurface = Enum.SurfaceType.Smooth
194
o2.TopSurface = Enum.SurfaceType.Smooth
195
o3.Parent = o2
196
o3.MeshId = "http://www.roblox.com/asset/?id=122309814"
197
o3.Scale = Vector3.new(2.5, 2.5, 2.5)
198
o3.TextureId = "http://www.roblox.com/asset/?id=127659109"
199
o3.MeshType = Enum.MeshType.FileMesh
200
o4.Name = "Running"
201
o4.Parent = o2
202
o4.SoundId = "http://www.roblox.com/asset/?id=122292723"
203
o4.Looped = true
204
o6.Name = "holdAni"
205
o6.Parent = o1
206
o6.AnimationId = "http://www.roblox.com/Asset?ID=104506550"
207
o7.Name = "ThumbnailFixer"
208
o7.Parent = o1
209
o7.Disabled = true
210
table.insert(cors,coroutine.create(function()
211
wait()
212
runDummyScript(function()
213
function WaitForChild(parent,child)
214
    while not parent:FindFirstChild(child) do print("roped waiting for " .. child) wait() end
215
    return parent[child]
216
end
217
 
218
local handle = WaitForChild(script.Parent,'Handle')
219
 
220
script.Parent.Grip = CFrame.new(1.40000021, 1.96000028, -1.4000001, 1, 0, 0, 0, 1, -3.9340253e-007, 0, 3.9340253e-007, 1)
221
 
222
handle.Size = Vector3.new(0.2, 4.89, 6.08)
223
end,o7)
224
end))
225
o8.Name = "continuumScript"
226
o8.Parent = o1
227
table.insert(cors,coroutine.create(function()
228
wait()
229
runDummyScript(function()
230
function WaitForChild(parent,child)
231
    while not parent:FindFirstChild(child) do print("roped waiting for " .. child) wait() end
232
    return parent[child]
233
end
234
 
235
local handle = WaitForChild(script.Parent,'Handle')
236
 
237
local EngineSound = WaitForChild(handle,'Running')
238
 
239
local HoldAni = WaitForChild(script.Parent,'holdAni')
240
 
241
local left=false
242
local right=false
243
local up=false
244
local down=false
245
local mouse
246
local Character
247
local key_down_connect
248
local key_up_connect
249
 
250
local thrustForce
251
local thrustMagnitude
252
local thrustDirection
253
local RotationForce
254
local TurnGyro
255
 
256
local HoldAniTrack
257
 
258
local torsoWeld
259
 
260
local SmokePart = Instance.new('Part')
261
SmokePart.Transparency = 1
262
SmokePart.Size = Vector3.new(0,0,0)
263
local ExhaustSmoke = Instance.new('Smoke')
264
ExhaustSmoke.Parent = SmokePart
265
ExhaustSmoke.Size = .1
266
ExhaustSmoke.RiseVelocity = .01
267
ExhaustSmoke.Color = Color3.new(.5,.5,.5)
268
 
269
local acceleration = 10
270
local deceleration = 10
271
local turnAlpha = .30
272
local alphaDampening = .2
273
 
274
local Equipped = false
275
 
276
local LastPosition = nil
277
local ActualVelocity = Vector3.new(0,0,0)
278
 
279
local FakeHandle = nil
280
local FrontWheel = Instance.new('Part')
281
FrontWheel.FormFactor = 'Custom'
282
FrontWheel.CanCollide = false
283
FrontWheel.Size = Vector3.new(0,0,0)
284
 
285
local WheelMesh = Instance.new('SpecialMesh')
286
WheelMesh.MeshId = "http://www.roblox.com/asset/?id=122202439"
287
WheelMesh.TextureId = "http://www.roblox.com/asset/?id=122185866"
288
WheelMesh.Scale = Vector3.new(2.5,2.5,2.5)
289
   
290
local Light = FrontWheel:Clone()
291
local LightWeld = nil
292
 
293
local FrontMotor = nil
294
local BackWheel = FrontWheel:Clone()
295
local BackMotor = nil
296
 
297
local CurrentSpeed=0
298
local turnSpeed=0
299
local turnSpeedAim=5
300
function ThrustUpdater()
301
    while Equipped do
302
        local direction = Character:FindFirstChild("Torso").CFrame.lookVector
303
        direction = Vector3.new(direction.x,0,direction.z).unit
304
        thrustForce.velocity = direction*(CurrentSpeed)
305
        EngineSound.Pitch = 1+(math.abs(CurrentSpeed/50)*1)
306
       
307
        if FrontMotor then
308
            FrontMotor.DesiredAngle=(999999999)*    (-CurrentSpeed/math.abs(CurrentSpeed))
309
            FrontMotor.MaxVelocity = CurrentSpeed/250
310
            if BackMotor then
311
                BackMotor.DesiredAngle = FrontMotor.DesiredAngle
312
                BackMotor.MaxVelocity = FrontMotor.MaxVelocity 
313
            end
314
        end
315
       
316
        RotationForce.angularvelocity = Vector3.new(0, turnSpeed, 0)
317
        if math.abs(turnSpeed)>alphaDampening    then
318
            turnSpeed= turnSpeed-((alphaDampening)*(math.abs(turnSpeed)/turnSpeed))
319
        else
320
            turnSpeed = 0      
321
        end
322
        local leanAmount= -turnSpeed*(math.pi/6)/4
323
       
324
        if not forwards or back then
325
            CurrentSpeed = CurrentSpeed*.99        
326
        end    
327
       
328
        local xzAngle = math.atan2(Character.Torso.CFrame.lookVector.z,0, Character.Torso.CFrame.lookVector.x)
329
        TurnGyro.cframe=CFrame.Angles(leanAmount*direction.x,0,leanAmount*direction.z)
330
        ExhaustSmoke.Opacity = (math.min(math.abs(CurrentSpeed),10)/10)*.5
331
        if LastPosition then
332
            local npos = Vector3.new(Character.Torso.CFrame.p.x,0,Character.Torso.CFrame.p.z)
333
            --(npos-LastPosition).magnitude
334
            local myspeed =Vector3.new(FakeHandle.Velocity.X,0,FakeHandle.Velocity.Z).magnitude
335
            local velocityDifference = math.abs((myspeed - (thrustForce.velocity.magnitude)))
336
            if myspeed>3 and thrustForce.velocity.magnitude>3 and velocityDifference> .7*thrustForce.velocity.magnitude then
337
                print('stopping: '..myspeed.." : " .. thrustForce.velocity.magnitude)
338
                CurrentSpeed=CurrentSpeed*.9
339
            end
340
           
341
        end
342
        LastPosition = Vector3.new(Character.Torso.CFrame.p.x,0,Character.Torso.CFrame.p.z)
343
        wait(1/60)
344
    end
345
   
346
end
347
 
348
 
349
function onEquipped(nmouse)
350
    print('got to equipped')
351
    Spawn(function()
352
        if Equipped then
353
            return
354
        end
355
        --
356
            Character=script.Parent.Parent
357
            local myTorso = WaitForChild(Character,'Torso')
358
            if not FakeHandle then
359
                FakeHandle = handle:Clone()
360
                FakeHandle.Name = 'FakeHandle'
361
                FakeHandle.Size = Vector3.new(1, 4.89, 6.08)
362
                FakeHandle:WaitForChild('Mesh').MeshId = "http://www.roblox.com/asset/?id=122185640"
363
               
364
            end
365
            FakeHandle.Parent = script.Parent
366
            FakeHandle.CFrame = myTorso.CFrame
367
            handle.Transparency = 1
368
 
369
            Spawn(function()
370
               
371
                FrontWheel.Parent = FakeHandle
372
                    FrontMotor = Instance.new('Motor6D')
373
                    FrontMotor.C0 = CFrame.Angles(0,math.pi/2,0)+Vector3.new(0,-1.1,-3.6)
374
                    FrontMotor.C1 = CFrame.Angles(0,-math.pi/2,0)
375
                    FrontMotor.Part0 = FakeHandle
376
                    FrontMotor.Part1 = FrontWheel
377
                    FrontMotor.Parent =FakeHandle
378
                WheelMesh:Clone().Parent = FrontWheel
379
                   
380
                BackWheel.Parent = FakeHandle
381
                    BackMotor = Instance.new('Motor6D')
382
                    BackMotor.C0 = CFrame.Angles(0,math.pi/2,0)+Vector3.new(0,-1.1,2.8)
383
                    BackMotor.C1 = CFrame.Angles(0,-math.pi/2,0)
384
                    BackMotor.Part0 = FakeHandle
385
                    BackMotor.Part1 = BackWheel
386
                    BackMotor.Parent =FakeHandle
387
                WheelMesh:Clone().Parent = BackWheel
388
               
389
                Light.Parent = FakeHandle
390
                    LightWeld = Instance.new('Weld')
391
                    LightWeld.C0 = CFrame.new(0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
392
                    LightWeld.C1 = CFrame.new(-0.140708923, -0.749996185, -0.9377985, -1.63912773e-007, -1.27675008e-008, -1.00000024, -2.05633661e-008, 0.99999994, 3.65663944e-009, 0.999999881, 5.65337004e-008, -7.4505806e-008)
393
                    LightWeld.Part0 = FakeHandle
394
                    LightWeld.Part1 = Light
395
                    LightWeld.Parent = FakeHandle
396
                    local tlight = Instance.new('SpotLight')
397
                    tlight.Brightness = 5
398
                    tlight.Angle=45
399
                    tlight.Color = Color3.new(255/255,252/255,153/255)
400
                    tlight.Parent = Light
401
                    tlight.Range = 40
402
                   
403
            end)
404
           
405
            CurrentSpeed=0
406
            turnSpeed=0
407
            print('got in if')
408
            mouse=nmouse
409
            Equipped = true
410
           
411
            handle.CFrame = myTorso.CFrame
412
            WaitForChild(Character,'Humanoid').PlatformStand = true
413
           
414
            if RotationForce then RotationForce:Destroy() end
415
            RotationForce = Instance.new('BodyAngularVelocity')
416
            RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
417
            RotationForce.angularvelocity = Vector3.new(0, 0, 0)
418
            RotationForce.Parent = myTorso
419
           
420
            if thrustForce then thrustForce:Destroy() end
421
            thrustForce = Instance.new('BodyVelocity')
422
            thrustForce.maxForce = Vector3.new(math.huge,0,math.huge)
423
            thrustForce.velocity = Vector3.new(0,0,0)
424
            thrustForce.P = 100
425
            thrustForce.Parent = FakeHandle--myTorso
426
           
427
            if TurnGyro then TurnGyro:Destroy() end
428
            TurnGyro = Instance.new('BodyGyro')
429
            TurnGyro.maxTorque = Vector3.new(5000,0,5000)
430
            TurnGyro.P = 300
431
            TurnGyro.D=100
432
            TurnGyro.Parent = myTorso
433
           
434
            Spawn(ThrustUpdater)
435
            if HoldAniTrack then HoldAniTrack:Stop() end
436
            HoldAniTrack = WaitForChild(Character,'Humanoid'):LoadAnimation(HoldAni)
437
            HoldAniTrack:Play()
438
            Spawn(function()
439
               
440
               
441
                myTorso.Anchored = true
442
                myTorso.CFrame = myTorso.CFrame+Vector3.new(0,3,0)
443
               
444
                if torsoWeld then torsoWeld:Destroy() end
445
                torsoWeld=Instance.new('Weld')
446
                torsoWeld.C0 = CFrame.Angles(0,0,0) + Vector3.new(0, -1.6, -0.7)
447
                torsoWeld.Part0 = myTorso
448
                torsoWeld.Part1 = FakeHandle
449
                torsoWeld.Parent = FakeHandle
450
                FakeHandle.CanCollide = true
451
               
452
                wait(.1)
453
                FakeHandle.CanCollide = true
454
                myTorso.Anchored = false
455
                myTorso.CFrame = myTorso.CFrame+Vector3.new(0,3,0)
456
            end)
457
           
458
            if key_down_connect then
459
                key_down_connect:disconnect()
460
                key_up_connect:disconnect()
461
            end
462
            key_down_connect=mouse.KeyDown:connect(keyDownFunc)
463
            key_up_connect=mouse.KeyUp:connect(keyUpFunc)
464
       
465
            SmokePart.Parent = FakeHandle
466
 
467
            local tweld=Instance.new('Weld')
468
            tweld.C0 = CFrame.new(0.600000024, 1.10000014, -2.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1)
469
            tweld.Part0 = SmokePart
470
            tweld.Part1 = FakeHandle
471
            tweld.Parent = SmokePart
472
           
473
            EngineSound:Play()
474
            Character.Humanoid.WalkSpeed = 0
475
        --end
476
    end)
477
end
478
 
479
 
480
function onUnequipped()
481
    Equipped = false
482
    if SmokePart then
483
        SmokePart.Parent = nil
484
    end
485
    if FakeHandle then
486
        FakeHandle:Remove()
487
        FakeHandle = nil
488
    end
489
    handle.Transparency = 0
490
    --handle.Size = Vector3.new(0.2, 0.2, 0.2)
491
    forwards = false
492
    left = false
493
    back = false
494
    right = false  
495
    if RotationForce then
496
        RotationForce:Destroy()
497
        RotationForce=nil
498
    end
499
    if thrustForce then
500
        thrustForce:Destroy()
501
        thrustForce=nil
502
    end
503
    if TurnGyro then
504
        TurnGyro:Destroy()
505
        TurnGyro=nil
506
    end
507
    if HoldAniTrack then
508
        HoldAniTrack:Stop()
509
    end
510
    if torsoWeld then
511
        torsoWeld:Destroy()
512
        torsoWeld=nil
513
    end
514
    if key_down_connect then
515
        key_down_connect:disconnect()
516
        key_down_connect=nil
517
    end
518
    if key_up_connect then
519
        key_up_connect:disconnect()
520
        key_up_connect=nil
521
    end
522
    if EngineSound then
523
        EngineSound:Stop()
524
    end
525
    if Character and Character:FindFirstChild('Humanoid') then
526
        Character.Humanoid.WalkSpeed = 16
527
        Character.Humanoid.PlatformStand = false
528
    end
529
    print("I unequipped!")
530
end
531
 
532
 
533
 
534
 
535
function keyUpFunc(key)
536
    if key == nil then return end
537
    local key = key:lower()
538
    if key == "w" then
539
        forwards = false
540
    elseif key == "a" then
541
        left = false
542
    elseif key == "s" then
543
        back = false
544
    elseif key == "d" then
545
        right = false  
546
    end
547
end
548
local LastSpace = tick()
549
function keyDownFunc(key)  
550
    if key == nil then return end
551
    if inIntro then return end
552
    local key = key:lower()
553
    if key == "w" then
554
        forwards = true
555
        while forwards do
556
            CurrentSpeed = math.min(70,CurrentSpeed+(acceleration*(1/30)))
557
            wait(1/30)
558
        end
559
    elseif key == "a" then
560
        left = true
561
        while left do
562
            turnSpeed= math.min(5,turnSpeed+(turnAlpha))
563
            wait(1/30)
564
        end
565
    elseif key == "s" then
566
        back = true
567
        while back do
568
            if CurrentSpeed>0 then
569
                CurrentSpeed = math.max(-20,CurrentSpeed-(deceleration*2.8*(1/30)))
570
            else
571
                CurrentSpeed = math.max(-20,CurrentSpeed-(deceleration*(1/30)))
572
            end
573
            wait(1/30)
574
        end
575
    elseif key == "d" then
576
        right = true
577
 
578
        while right do
579
            turnSpeed= math.max(-5,turnSpeed-(turnAlpha))
580
            wait(1/30)
581
        end
582
    elseif key == ' ' then
583
        if tick()-LastSpace>1.9 then
584
            LastSpace = tick()
585
            local bforce = Instance.new('BodyForce')
586
            bforce.force = Vector3.new(0,25000,0)
587
            bforce.Parent = FakeHandle
588
            wait(.1)
589
            bforce:Destroy()
590
        end
591
    end
592
 
593
end
594
 
595
script.Parent.Unequipped:connect(onUnequipped)
596
script.Parent.Equipped:connect(onEquipped)
597
 
598
 
599
end,o8)
600
end))
601
o10.Parent = o1
602
table.insert(cors,coroutine.create(function()
603
wait()
604
runDummyScript(function()
605
-- Nascardavid12 made this motorcycle. work's to be put in starterpack.
606
 
607
-- Thank you for using a Nascardavid12 Model.