View difference between Paste ID: iXempdL2 and myEEyfw1
SHOW: | | - or go back to the newest paste.
1-
-- > CREATED BY WULFBUG9 2014
1+
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,game,owner = owner,game
4
local RealPlayer = Player
5
do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end -- > CREATED BY WULFBUG9 2014
6
-- > Seriously, I made this. (wulfbug9)
7
-- > I'm releasing a ton of my other scripts on this pastebin, too. So go check them out.
8
function rand(a)return (math.random()-.5)*2*a end
9
function q(f,arg)return coroutine.resume(coroutine.create(f),unpack(arg or {}))end
10
function fade(p,s)q(function(part,start)for i=start,1,.05 do part.Transparency = part.Transparency+0.05 wait(1/30)end end,{p,s})end
11
function appear(p,s)q(function(part,start)for i=start,0,-.05 do part.Transparency = part.Transparency-0.05 wait(1/30)end end,{p,s})end
12
function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
13
	local p = Instance.new("Part",Parent)p.Name = Name
14
	p.FormFactor = "Custom"p.Size = Size
15
	p.Anchored = Anch p.CFrame = CFrame
16
	p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
17
	p.TopSurface = 0 p.CanCollide = Can
18
	p.BottomSurface = 0 p.Material = Mat
19
	p.Reflectance = Ref or 0;p:BreakJoints()
20
	p.Locked = true;return p
21
end
22
function WedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
23
	local p = Instance.new("WedgePart",Parent)p.Name = Name
24
	p.FormFactor = "Custom"p.Size = Size
25
	p.Anchored = Anch p.CFrame = CFrame
26
	p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
27
	p.TopSurface = 0 p.CanCollide = Can
28
	p.BottomSurface = 0 p.Material = Mat
29
	p.Reflectance = Ref or 0;p:BreakJoints()
30
	p.Locked = true;return p
31
end
32
function CornerWedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
33
	local p = Instance.new("CornerWedgePart",Parent)p.Name = Name;p.Size = Size
34
	p.Anchored = Anch p.CFrame = CFrame
35
	p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
36
	p.TopSurface = 0 p.CanCollide = Can
37
	p.BottomSurface = 0 p.Material = Mat
38
	p.Reflectance = Ref or 0;p:BreakJoints()
39
	p.Locked = true;return p
40
end
41
function Mesh(Parent,Type,Scale,ID,TID)
42
	local m = Instance.new("SpecialMesh",Parent)m.MeshType = Type
43
	m.Scale = Scale or Vector3.new(1,1,1)
44
	if ID then m.MeshId = ID end if TID then m.TextureId = TID end
45
	return m
46
end
47
function Weld(p1,p2,c0,c1)
48
	local w = Instance.new("Weld",p1)w.Part0 = p1;w.Part1 = p2
49
	w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
50
	return w
51
end
52
function cslerp(c1,c2,t)
53
	local function s(a,b,c)return (1-c)*a+(c*b)end 
54
	local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
55
	local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
56
	for i,v in pairs(com1)do com1[i] = s(v,com2[i],t)end
57
	return CFrame.new(com1[1],com1[2],com1[3])*CFrame.Angles(select(4,unpack(com1)))
58
end
59
local char
60
---------------------------------------------
61
player = game:service("Players").LocalPlayer
62
repeat wait() char = player.Character until char
63
pcall(function()char:FindFirstChild("Animate"):Destroy()end)
64
root = char:WaitForChild("HumanoidRootPart")
65
torso = char:WaitForChild("Torso")
66
humanoid = char:WaitForChild("Humanoid")
67
mouse = player:GetMouse()
68
step = game:service("RunService").Stepped
69
asset = "http://www.roblox.com/asset/?id="
70
meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
71
sounds = {["explode"] = 130792180;}
72
colour = "White"
73
scolour = tostring(BrickColor.random())--"Lime green"
74
Attacking = false
75
local bv,bp,bg
76
hover = 10
77
carspeed = 60
78
keysdown = {}
79
c0ls = CFrame.new(-1,0.5,0)*CFrame.Angles(math.pi/6,0,0)
80
c0rs = CFrame.new(1,0.5,0)*CFrame.Angles(math.pi/6,0,0)
81
c1ls = CFrame.new(0.5,0.5,0)
82
c1rs = CFrame.new(-0.5,0.5,0)
83
c0tw = CFrame.new(0,0,0)
84
c1tw = CFrame.new(0,0,0)
85
rs = Weld(torso,char:WaitForChild("Right Arm"),c0rs,c1rs)
86
ls = Weld(torso,char:WaitForChild("Left Arm"),c0ls,c1ls)
87
tw = Weld(root,torso,c0tw,c1tw)
88
---------------------------------------------
89
function Smoke(origin,color)
90
	local p = Part("Effect",workspace,Vector3.new(2,2,2),origin*CFrame.new(rand(10),-1,rand(10)),color or "Black",.1,false,false,"SmoothPlastic")
91
	local m = Mesh(p,"Sphere",Vector3.new(1.25,1.25,1.25))
92
	local bp = Instance.new("BodyPosition",p)bp.D = 100 bp.P = 100 bp.position = p.Position+Vector3.new(0,7,0)
93
	q(function(pa,me)
94
		fade(pa,.1)
95
		for i=25,100 do
96
			me.Scale = me.Scale+Vector3.new(0.15,0.1,0.15)
97
			wait(1/30)
98
		end
99
		pa:Destroy()
100
	end,{p,m})
101
end
102
function crownExplode(origin,color,size)
103
	local p = Part("Effect",workspace,Vector3.new(size,size,size),origin,color,.2,true,false,"SmoothPlastic")
104
	local m = Mesh(p,"FileMesh",Vector3.new(size/2,size/2,size/2),asset..meshes["crown"])
105
	q(function(pa,me)
106
		for i=.2,1,.025 do
107
			me.Scale = me.Scale+Vector3.new(0.75,0.75,0.75)
108
			pa.Transparency = i
109
			wait(1/30)
110
		end
111
		pa:Destroy()
112
	end,{p,m})
113
end
114
function quickSound(id,v)
115
	local s = Instance.new("Sound",workspace)
116
	s.SoundId = id
117
	s.PlayOnRemove = true
118
	s.Volume = v or 1
119
	delay(0.025,function()s:remove()end)
120
end
121
function checkDmgArea(origin,dmg,d)
122
	for i,v in pairs(workspace:children())do
123
		if v~=char and v:FindFirstChild("Torso") then
124
			local h;
125
			for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
126
			local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
127
			if dist < d and h~=nil then
128
				h.Health = h.Health - dmg
129
			end
130
		end
131
	end
132
end
133
function Shoot(start,dmg)
134
	dmg = dmg or 15
135
	local vel = start.lookVector
136
	local p = Part("Bullet",workspace,Vector3.new(4,4,4),start,"Black",0,true,false,"SmoothPlastic")
137
	local m = Mesh(p,"Sphere")
138
	local num = 0
139
	local ign = char:children()
140
	local connect
141
	connect = step:connect(function()
142
		num = num + 1
143
		local pp = p.Position
144
		local h,po
145
		vel = vel - Vector3.new(0,math.min(999.5,vel.magnitude/50),0)
146
		repeat
147
			local r = Ray.new(pp,vel.unit*math.min(999.5,vel.magnitude/100+4))
148
			h,po = workspace:FindPartOnRayWithIgnoreList(r,ign)
149
			if h then
150
				if h.CanCollide then break
151
				else table.insert(ign,h)h = nil
152
				end
153
			else break
154
			end
155
		until false
156
		p.CFrame = CFrame.new(po,po+vel)
157
		q(function(b)
158
			local a = b:Clone()
159
			a.Parent = workspace
160
			for i=1,-.05,-.05 do
161
				wait()
162
				a:FindFirstChild("Mesh").Scale = Vector3.new(i,i,i)
163
				a.Transparency = a.Transparency + .05
164
			end
165
			a:Destroy()
166
		end,{p})
167
		if h or num > 300 then
168
			local cf = p.CFrame
169
			for i=1,3 do Smoke(cf*CFrame.new(0,4,0),"Black")end
170
			crownExplode(CFrame.new(cf.x,cf.y,cf.z),"Black",2)
171
			quickSound(asset..sounds["explode"],2)
172
			checkDmgArea(cf,dmg,10)
173
			p:Destroy()
174
			connect:disconnect()
175
		end
176
	end)
177
end
178
function Fire()
179
	Attacking = true
180
	for i=1,10 do
181
		wait(1/30)
182
		local speed = i/10
183
		rs.C0 = cslerp(rs.C0,c0rs*CFrame.Angles(-math.pi/2.5,0,0),speed)
184
		ls.C0 = cslerp(ls.C0,c0ls*CFrame.Angles(-math.pi/2.5,0,0),speed)
185
		tw.C0 = cslerp(tw.C0,c0tw*CFrame.Angles(0,math.pi/2,0),speed)
186
	end
187
	local b = Part("Bullet",char,Vector3.new(4,4,4),torso.CFrame,"Black",0,false,false,"SmoothPlastic")
188
	Mesh(b,"Sphere")
189
	local w = Weld(torso,b,CFrame.new(0,0,-.5))
190
	for i=1,5 do
191
		wait(1/30)
192
		local speed = i/5
193
		rs.C0 = cslerp(rs.C0,c0rs*CFrame.Angles(math.pi/2.5,0,0),speed)
194
		ls.C0 = cslerp(ls.C0,c0ls*CFrame.Angles(math.pi/2.5,0,0),speed)
195
		tw.C0 = cslerp(tw.C0,c0tw,speed)
196
		w.C0 = cslerp(w.C0,CFrame.new(0,5,-3),speed)
197
	end
198
	Shoot(b.CFrame,52.5)
199
	b:Destroy()
200
	for i=1,10 do
201
		wait(1/30)
202
		local speed = i/20
203
		rs.C0 = cslerp(rs.C0,c0rs,speed)
204
		ls.C0 = cslerp(ls.C0,c0ls,speed)
205
		tw.C0 = cslerp(tw.C0,c0tw,speed)
206
	end
207
	Attacking = false
208
end
209
---------------------------------------------
210
pcall(function()char:FindFirstChild("CAR"):Destroy()end)
211
model = Instance.new("Model",char)
212
model.Name = "CAR"
213
base = Part("P",model,Vector3.new(6,6,6),torso.CFrame*CFrame.new(6,6,0),colour,0,false,false,"Plastic")
214
torso.CFrame = base.CFrame
215
basem = Mesh(base,"Sphere",Vector3.new(1,.5,1))
216
side = Part("P",model,Vector3.new(6,2,6),torso.CFrame*CFrame.new(6,6,0),colour,0,false,false,"Plastic")
217
sidem = Mesh(side,"FileMesh",Vector3.new(5.375,5.375,20),asset..meshes["ring"])
218
sidew = Weld(base,side,CFrame.new(0,1,0)*CFrame.Angles(math.pi/2,0,0))
219
side2 = Part("P",model,Vector3.new(6,2,6),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
220
side2m = Mesh(side2,"FileMesh",Vector3.new(5.375,5.375,5),asset..meshes["ring"])
221
side2w = Weld(side,side2,CFrame.new(0,0,-1.25))
222
under = Part("P",model,Vector3.new(2,6,2),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
223
underm = Mesh(under,"FileMesh",Vector3.new(2,6,2),asset..meshes["spike"])
224
underw = Weld(base,under,CFrame.new(0,-1,0)*CFrame.Angles(math.pi,0,0))
225
prop = Part("P",model,Vector3.new(0.5,0,4),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
226
propm = Mesh(prop,"Sphere")
227
propw = Weld(under,prop,CFrame.new(0,2.25,0))
228
torweld = Weld(base,root,CFrame.new(0,3,-1))
229
bp = Instance.new("BodyPosition")
230
bp.maxForce = Vector3.new(0,1/0,0)
231
bv = Instance.new("BodyVelocity")
232
bv.maxForce = Vector3.new(1/0,0,1/0)
233
bg = Instance.new("BodyGyro")
234
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
235
humanoid.WalkSpeed = 0
236
---------------------------------------------
237
mouse.KeyDown:connect(function(key)
238
	key:lower()
239
	keysdown[key] = true
240
end)
241
mouse.KeyUp:connect(function(key)
242
	key:lower()
243
	keysdown[key] = false
244
end)
245
mouse.Button1Down:connect(function()
246
	if not Attacking then
247
		Fire()
248
	end
249
end)
250
local function bn(key) return keysdown[key]and 1 or 0 end
251
---------------------------------------------
252
step:connect(function()
253
	hover = hover-bn("e")+bn("q")
254
	bp.Parent,bg.Parent,bv.Parent = base,base,base
255
	bp.position = Vector3.new(0,math.sin(tick())+hover,0)
256
	bg.cframe = workspace.CurrentCamera.CoordinateFrame
257
	local vel = workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0-bn("a")+bn("d"),0,0-bn("w")+bn("s")))*Vector3.new(1,0,1)
258
	bv.velocity = (vel.magnitude > 0 and vel.unit*carspeed)or Vector3.new(0,0,0)
259
	propw.C0 = propw.C0*CFrame.Angles(0,.2,0)
260
end)