SHOW:
|
|
- or go back to the newest paste.
1 | - | local plr = game:service'Players'.LocalPlayer |
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,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end local plr = game:service'Players'.LocalPlayer | |
6 | local char = plr.Character | |
7 | local mouse = plr:GetMouse() | |
8 | local humanoid = char:findFirstChild("Humanoid") | |
9 | local torso = char:findFirstChild("Torso") | |
10 | local head = char.Head | |
11 | local ra = char:findFirstChild("Right Arm") | |
12 | local la = char:findFirstChild("Left Arm") | |
13 | local rl = char:findFirstChild("Right Leg") | |
14 | local ll = char:findFirstChild("Left Leg") | |
15 | local rs = torso:findFirstChild("Right Shoulder") | |
16 | local ls = torso:findFirstChild("Left Shoulder") | |
17 | local rh = torso:findFirstChild("Right Hip") | |
18 | local lh = torso:findFirstChild("Left Hip") | |
19 | local neck = torso:findFirstChild("Neck") | |
20 | local cam = workspace.CurrentCamera | |
21 | ||
22 | ||
23 | ||
24 | OVERPowered = false | |
25 | ||
26 | local spear = Instance.new("Model", char) | |
27 | spear.Name = "Spear" | |
28 | ||
29 | local BG = Instance.new("BodyGyro") | |
30 | BG.maxTorque = Vector3.new(0, 20e+763, 0) | |
31 | BG.P = 20e+003 | |
32 | BG.D = 100 | |
33 | ||
34 | local handle = Instance.new("Part", spear) | |
35 | handle.formFactor = "Custom" | |
36 | handle.Size = Vector3.new(0.2, 0.2, 4) | |
37 | handle.BrickColor = BrickColor.new("Brown") | |
38 | handle:BreakJoints() | |
39 | Instance.new("SpecialMesh", handle).MeshId = "http://www.roblox.com/asset/?id=43645078" | |
40 | handle.Mesh.Scale = Vector3.new(1.5, 1.5, 1.5) | |
41 | ||
42 | local weld = Instance.new("Weld", handle) | |
43 | weld.C0 = CFrame.new(0, 0.95, 0) * CFrame.Angles(0, 0, 0) | |
44 | weld.Part0 = handle | |
45 | weld.Part1 = ra | |
46 | ||
47 | ||
48 | function animate() | |
49 | BGcframestored = mouse.Hit | |
50 | BG.Parent = torso | |
51 | coroutine.wrap(function() | |
52 | for i = 0, 70, 10 do | |
53 | neck.C0 = neck.C0 * CFrame.Angles(0, 0, math.rad(10)) | |
54 | BG.cframe = BGcframestored * CFrame.Angles(0, -math.rad(i), 0) | |
55 | wait() | |
56 | end | |
57 | end)() | |
58 | rs.Parent = nil | |
59 | local ar = Instance.new("Part", spear) | |
60 | ar.FormFactor = "Custom" | |
61 | ar.Size = Vector3.new(1, 1, 1) | |
62 | ar.Transparency = 1 | |
63 | ar.CanCollide = false | |
64 | ar.Locked = true | |
65 | ar:BreakJoints() | |
66 | local weld = Instance.new("Weld", ar) | |
67 | weld.C0 = CFrame.new(0, 0.5, 0) | |
68 | weld.Part0 = ra | |
69 | weld.Part1 = ar | |
70 | local motor = Instance.new("Motor", spear) | |
71 | motor.Part0 = torso | |
72 | motor.Part1 = ar | |
73 | motor.C0 = CFrame.new(1.5, 0.5, 0) | |
74 | for angle = 0, 180, 20 do | |
75 | motor.C0 = CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(angle), -math.rad(60), 0) | |
76 | game:service'RunService'.Stepped:wait() | |
77 | end | |
78 | ||
79 | ||
80 | ||
81 | ||
82 | coroutine.wrap(function() | |
83 | for angle = 180, 0, -20 do | |
84 | motor.C0 = CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(angle), -math.rad(angle/3), 0) | |
85 | game:service'RunService'.Stepped:wait() | |
86 | end | |
87 | end)() | |
88 | coroutine.wrap(function() | |
89 | wait(0.1) | |
90 | for i = 70, 0, -10 do | |
91 | neck.C0 = neck.C0 * CFrame.Angles(0, 0, -math.rad(10)) | |
92 | BG.cframe = BGcframestored * CFrame.Angles(0, -math.rad(i), 0) | |
93 | wait() | |
94 | end | |
95 | wait(0.4) | |
96 | motor:Destroy() | |
97 | BG.Parent = nil | |
98 | rs.Parent = torso | |
99 | ar:Destroy() | |
100 | end)() | |
101 | end | |
102 | ||
103 | --billboardGui func | |
104 | ||
105 | function billboardGui(msg, objvar) | |
106 | ||
107 | coroutine.wrap(function() | |
108 | local prt = Instance.new("Part", char) | |
109 | prt.FormFactor = "Custom" | |
110 | prt.Size = Vector3.new(0.1, 0.1, 0.1) | |
111 | prt.Transparency = 1 | |
112 | prt.CanCollide = false | |
113 | prt.CFrame = CFrame.new(objvar.CFrame.x, objvar.CFrame.y, objvar.CFrame.z) | |
114 | prt.Anchored = true | |
115 | ||
116 | local bg = Instance.new("BillboardGui") | |
117 | bg.Parent = prt | |
118 | bg.Adornee = prt | |
119 | bg.Size = UDim2.new(4, 0, 3.5, 0) | |
120 | bg.ExtentsOffset = Vector3.new(0, 0, 0) | |
121 | local lol = Instance.new("TextLabel") | |
122 | lol.Size = UDim2.new(1.3, 0, 0.4, 0) | |
123 | lol.TextScaled = true | |
124 | lol.TextWrapped = true | |
125 | lol.BackgroundTransparency = 1 | |
126 | lol.Parent = bg | |
127 | lol.FontSize = "Size24" | |
128 | lol.TextColor3 = Color3.new(1, 0, 0) | |
129 | lol.TextStrokeTransparency = 0 | |
130 | lol.Font = "ArialBold" | |
131 | lol.Text = (msg) | |
132 | ||
133 | for _ = 2, 15, 1 do | |
134 | if prt == nil then return end | |
135 | prt.CFrame = prt.CFrame * CFrame.new(0, 0.2, 0) | |
136 | game:service'RunService'.Stepped:wait() | |
137 | end | |
138 | for _ = 0, 10 do | |
139 | lol.TextStrokeTransparency = lol.TextStrokeTransparency + 0.1 | |
140 | lol.TextTransparency = lol.TextTransparency + 0.1 | |
141 | wait() | |
142 | end | |
143 | ||
144 | prt:Destroy() | |
145 | end)() | |
146 | end | |
147 | ||
148 | --ray func | |
149 | ||
150 | function rayCast(speed, gravity) | |
151 | coroutine.wrap(function() | |
152 | ||
153 | ||
154 | ||
155 | local rayPart = Instance.new("Part") | |
156 | ||
157 | rayPart.Name = "RayPart" | |
158 | ||
159 | rayPart.BrickColor = BrickColor.new("Brown") | |
160 | ||
161 | rayPart.Anchored = true | |
162 | rayPart.CanCollide = false | |
163 | rayPart.Locked = true | |
164 | ||
165 | rayPart.TopSurface = Enum.SurfaceType.Smooth | |
166 | rayPart.BottomSurface = Enum.SurfaceType.Smooth | |
167 | rayPart.formFactor = Enum.FormFactor.Custom | |
168 | rayPart.Size = Vector3.new(0.2, 0.2, 3) | |
169 | Instance.new("SpecialMesh", rayPart).MeshId = "http://www.roblox.com/asset/?id=43645078" | |
170 | rayPart.Mesh.Scale = Vector3.new(1.5, 1.5, 1.5) | |
171 | ||
172 | ||
173 | ||
174 | ||
175 | ||
176 | local bulletposition = handle.Position + Vector3.new(0, 0, 0) | |
177 | ||
178 | local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-1,1), math.random(-2,2)))+( plr:GetMouse().Hit.p - bulletposition).unit*speed | |
179 | local bulletlastposition = bulletposition | |
180 | ||
181 | ||
182 | ||
183 | ||
184 | ||
185 | coroutine.resume(coroutine.create(function() | |
186 | while true do | |
187 | local dt = wait() | |
188 | bulletlastposition = bulletposition | |
189 | bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*gravity, 0)*dt) | |
190 | bulletposition = bulletposition + (bulletvelocity*dt) | |
191 | ||
192 | local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition)) | |
193 | ||
194 | local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} ) | |
195 | ||
196 | if (torso.Position - rayPart.Position).magnitude > 540 then | |
197 | rayPart:Destroy() | |
198 | break | |
199 | end | |
200 | ||
201 | ||
202 | if hit then | |
203 | local damage = math.random(24, 32) | |
204 | if hit.Parent:findFirstChild("Humanoid") ~= nil then | |
205 | if OVERPowered then | |
206 | hit.Parent:BreakJoints() | |
207 | else | |
208 | hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage | |
209 | billboardGui("-"..damage, rayPart) | |
210 | end | |
211 | ||
212 | end | |
213 | ||
214 | if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then | |
215 | if OVERPowered then | |
216 | hit.Parent.Parent:BreakJoints() | |
217 | else | |
218 | hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage | |
219 | billboardGui("-"..damage, rayPart) | |
220 | end | |
221 | ||
222 | ||
223 | if hit.Name == "Tire" and hit ~= nil then | |
224 | hit:BreakJoints() | |
225 | end | |
226 | ||
227 | end | |
228 | bulletposition = hitposition | |
229 | if hit.Name == "RayPart" then | |
230 | hit:Destroy() | |
231 | rayPart:Destroy() | |
232 | else | |
233 | wait(5) | |
234 | rayPart:Destroy() | |
235 | end | |
236 | break | |
237 | end | |
238 | rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(-math.pi, 0, 0) | |
239 | rayPart.Parent = workspace | |
240 | end | |
241 | end)) | |
242 | end)() | |
243 | end | |
244 | ||
245 | mouse.Button1Down:connect(function(mouse) | |
246 | if char.Humanoid.Health == 0 then | |
247 | return end | |
248 | if debounce then return end | |
249 | debounce = true | |
250 | animate() | |
251 | rayCast(100, 7) | |
252 | wait(0.8) | |
253 | debounce = false | |
254 | end) |