SHOW:
|
|
- or go back to the newest paste.
1 | --just put this on the top of a script and boom 89% works | |
2 | --note this does not work on big scripts | |
3 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
4 | local Player,game,owner = owner,game | |
5 | local RealPlayer = Player | |
6 | do | |
7 | local rp = RealPlayer | |
8 | script.Parent = rp.Character | |
9 | ||
10 | --RemoteEvent for communicating | |
11 | local Event = Instance.new("RemoteEvent") | |
12 | Event.Name = "UserInput_Event" | |
13 | ||
14 | --Fake event to make stuff like Mouse.KeyDown work | |
15 | local function fakeEvent() | |
16 | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} | |
17 | t.connect = t.Connect | |
18 | return t | |
19 | end | |
20 | ||
21 | --Creating fake input objects with fake variables | |
22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
26 | end} | |
27 | --Merged 2 functions into one by checking amount of arguments | |
28 | CAS.UnbindAction = CAS.BindAction | |
29 | ||
30 | --This function will trigger the events that have been :Connect()'ed | |
31 | local function te(self,ev,...) | |
32 | local t = m[ev] | |
33 | if t and t._fakeEvent then | |
34 | for _,f in pairs(t.Functions) do | |
35 | f(...) | |
36 | end | |
37 | end | |
38 | end | |
39 | m.TrigEvent = te | |
40 | UIS.TrigEvent = te | |
41 | ||
42 | Event.OnServerEvent:Connect(function(plr,io) | |
43 | if plr~=rp then return end | |
44 | m.Target = io.Target | |
45 | m.Hit = io.Hit | |
46 | if not io.isMouse then | |
47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
50 | end | |
51 | for _,t in pairs(CAS.Actions) do | |
52 | for _,k in pairs(t.Keys) do | |
53 | if k==io.KeyCode then | |
54 | t.Function(t.Name,io.UserInputState,io) | |
55 | end | |
56 | end | |
57 | end | |
58 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
59 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
60 | end | |
61 | end) | |
62 | Event.Parent = NLS([==[ | |
63 | local Player = game:GetService("Players").LocalPlayer | |
64 | local Event = script:WaitForChild("UserInput_Event") | |
65 | ||
66 | local Mouse = Player:GetMouse() | |
67 | local UIS = game:GetService("UserInputService") | |
68 | local input = function(io,a) | |
69 | if a then return end | |
70 | --Since InputObject is a client-side instance, we create and pass table instead | |
71 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
72 | end | |
73 | UIS.InputBegan:Connect(input) | |
74 | UIS.InputEnded:Connect(input) | |
75 | ||
76 | local h,t | |
77 | --Give the server mouse data 30 times every second, but only if the values changed | |
78 | --If player is not moving their mouse, client won't fire events | |
79 | while wait(1/30) do | |
80 | if h~=Mouse.Hit or t~=Mouse.Target then | |
81 | h,t=Mouse.Hit,Mouse.Target | |
82 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
83 | end | |
84 | end]==],Player.Character) | |
85 | ||
86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
87 | --Real game object | |
88 | local _rg = game | |
89 | ||
90 | --Metatable for fake service | |
91 | local fsmt = { | |
92 | __index = function(self,k) | |
93 | local s = rawget(self,"_RealService") | |
94 | if s then return s[k] end | |
95 | end, | |
96 | __newindex = function(self,k,v) | |
97 | local s = rawget(self,"_RealService") | |
98 | if s then s[k]=v end | |
99 | end, | |
100 | __call = function(self,...) | |
101 | local s = rawget(self,"_RealService") | |
102 | if s then return s(...) end | |
103 | end | |
104 | } | |
105 | local function FakeService(t,RealService) | |
106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
107 | return setmetatable(t,fsmt) | |
108 | end | |
109 | ||
110 | --Fake game object | |
111 | local g = { | |
112 | GetService = function(self,s) | |
113 | return self[s] | |
114 | end, | |
115 | Players = FakeService({ | |
116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) | |
117 | },"Players"), | |
118 | UserInputService = FakeService(UIS,"UserInputService"), | |
119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
120 | } | |
121 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
122 | g.service = g.GetService | |
123 | ||
124 | g.RunService = FakeService({ | |
125 | RenderStepped = _rg:GetService("RunService").Heartbeat, | |
126 | BindToRenderStep = function(self,name,_,fun) | |
127 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
128 | end, | |
129 | UnbindFromRenderStep = function(self,name) | |
130 | self._btrs[name]:Disconnect() | |
131 | end, | |
132 | },"RunService") | |
133 | ||
134 | setmetatable(g,{ | |
135 | __index=function(self,s) | |
136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
138 | end, | |
139 | __newindex = fsmt.__newindex, | |
140 | __call = fsmt.__call | |
141 | }) | |
142 | --Changing owner to fake player object to support owner:GetMouse() | |
143 | game,owner = g,g.Players.LocalPlayer | |
144 | end | |
145 | ||
146 | ||
147 | ||
148 | --Leeked by PointCoded to Romania12x | |
149 | ||
150 | script.Parent = nil | |
151 | local player = game.Players.LocalPlayer.Name | |
152 | ||
153 | local p = nil | |
154 | for _,v in pairs(game.Players:GetChildren()) do | |
155 | if (string.lower(player)==string.lower(v.Name)) then | |
156 | p = v | |
157 | end | |
158 | end | |
159 | if (p==nil) then return print("Cannot find player "..player) end | |
160 | ||
161 | local equipped = false | |
162 | local noarrow = false | |
163 | local delayTime = 1 --editable. Description: The interval of time that passes before a player is enabled to shoot another arrow after shooting one | |
164 | local damage = 50 --editable. Description: The amount of damage dealt to any found humanoid. | |
165 | local bowScale = 2 --editable. Description: The WHOLE NUMBER size of the bow. acceptable range is from 1 to Infinity. | |
166 | local velocityMin,velocityMax = 400,600 --editable. Description: The maximum and minimum allowed velocity for arrows. | |
167 | ||
168 | bu = (bowScale+1)/10 | |
169 | hbu = bu/2 | |
170 | dbu = bu*2 | |
171 | cubevec = Vector3.new(bu, bu, bu) | |
172 | reczvec = Vector3.new(bu*2, bu, bu) | |
173 | recxvec = Vector3.new(bu, bu, bu*2) | |
174 | ||
175 | function creczvec(num) | |
176 | return Vector3.new(bu*num, bu, bu) | |
177 | end | |
178 | ||
179 | function crecxvec(num) | |
180 | return Vector3.new(bu, bu, bu*num) | |
181 | end | |
182 | ||
183 | han = nil | |
184 | m = nil | |
185 | rg = nil | |
186 | bowp = { | |
187 | add = function(self, ...) | |
188 | local arg = {...} | |
189 | for i = 1,#arg do | |
190 | table.insert(self.dat, arg[i]) | |
191 | end | |
192 | end; | |
193 | dat = {} | |
194 | } | |
195 | local mid = {"http://www.roblox.com/asset/?id=85561125","http://www.roblox.com/asset/?id=85561640","http://www.roblox.com/asset/?id=85561157","http://www.roblox.com/asset/?id=85643448","http://www.roblox.com/asset/?id=49092825","http://www.roblox.com/asset/?id=36527138"} | |
196 | local sid = {"http://www.roblox.com/asset/?id=16211041","http://www.roblox.com/asset/?id=16211030"} | |
197 | for i = 1,#mid do | |
198 | game:GetService("ContentProvider"):Preload(mid[i]) | |
199 | end | |
200 | for i = 1,#sid do | |
201 | game:GetService("ContentProvider"):Preload(sid[i]) | |
202 | end | |
203 | ||
204 | function cp(pa, mo) | |
205 | local c = pa:clone() | |
206 | c.Parent = mo | |
207 | return c | |
208 | end | |
209 | ||
210 | function xbu(num) | |
211 | if (type(num)==type(1)) then | |
212 | return bu*num | |
213 | end | |
214 | end | |
215 | ||
216 | if (math.floor(bowScale)<bowScale) and (bowScale<math.floor(bowScale)+1) then | |
217 | return print("Error: Can not add decimal to whole number scale (NON-WHOLE)") | |
218 | elseif (math.floor(bowScale)<1) then | |
219 | return print("Error: Can not have bowScale property below 1 (NON-WHOLE)") | |
220 | end | |
221 | ||
222 | if (bowScale>5) then | |
223 | print("You're going to have a pretty big bow") | |
224 | end | |
225 | ||
226 | function createbow() | |
227 | if (p.Character==nil) then return end | |
228 | local char = p.Character | |
229 | if (char:FindFirstChild("Head")==nil) then return end | |
230 | local he = char["Head"] | |
231 | if (char:FindFirstChild("Right Arm")==nil) then return end | |
232 | local ra = char["Right Arm"] | |
233 | m = Instance.new("Model") | |
234 | m.Name = player.."'s bow" | |
235 | han = Instance.new("Part", m) | |
236 | Instance.new("BlockMesh", han) | |
237 | han.BrickColor = BrickColor.New("Silver flip/flop") | |
238 | han.Name = "Grip" | |
239 | han.FormFactor = 3 | |
240 | han.Size = cubevec | |
241 | han.TopSurface = 0 | |
242 | han.BottomSurface = 0 | |
243 | local ha1 = cp(han, m) | |
244 | ha1.Name = "bowpart" | |
245 | ha1.CFrame = han.CFrame*CFrame.new(bu, 0, -bu) | |
246 | local ha2 = cp(ha1, m) | |
247 | ha2.CFrame = han.CFrame*CFrame.new(-bu, 0, bu) | |
248 | local ha3 = cp(ha1, m) | |
249 | ha3.CFrame = han.CFrame*CFrame.new(dbu, 0, 0) | |
250 | local ha4 = cp(ha1, m) | |
251 | ha4.CFrame = han.CFrame*CFrame.new(bu, 0, bu) | |
252 | local ha5 = cp(ha1, m) | |
253 | ha5.CFrame = han.CFrame*CFrame.new(0, 0, dbu) | |
254 | local ha6 = cp(ha1, m) | |
255 | ha6.BrickColor = BrickColor.new("Medium stone grey") | |
256 | ha6.CFrame = han.CFrame*CFrame.new(bu, 0, 0) | |
257 | local ha7 = cp(ha6, m) | |
258 | ha7.CFrame = han.CFrame*CFrame.new(0, 0, bu) | |
259 | local ha8 = cp(ha1, m) | |
260 | ha8.BrickColor = BrickColor.new("Brown") | |
261 | ha8.CFrame = han.CFrame*CFrame.new(dbu, 0, bu) | |
262 | local ha9 = cp(ha8, m) | |
263 | ha9.CFrame = han.CFrame*CFrame.new(bu, 0, dbu) | |
264 | local h10 = cp(ha8, m) | |
265 | h10.Size = recxvec | |
266 | h10.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -hbu) | |
267 | local h11 = cp(ha8, m) | |
268 | h11.Size = reczvec | |
269 | h11.CFrame = han.CFrame*CFrame.new(-hbu, 0, xbu(3)) | |
270 | local h12 = cp(ha1, m) | |
271 | h12.BrickColor = BrickColor.new("Yellow flip/flop") | |
272 | h12.CFrame = han.CFrame*CFrame.new(dbu, 0, -bu) | |
273 | local h13 = cp(h12, m) | |
274 | h13.CFrame = han.CFrame*CFrame.new(-bu, 0, dbu) | |
275 | local h14 = cp(ha1, m) | |
276 | h14.BrickColor = BrickColor.new("Light orange brown") | |
277 | h14.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -dbu) | |
278 | local h15 = cp(h14, m) | |
279 | h15.CFrame = han.CFrame*CFrame.new(-dbu, 0, xbu(3)) | |
280 | local h16 = cp(ha8, m) | |
281 | h16.Size = crecxvec(3) | |
282 | h16.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(3)) | |
283 | local h17 = cp(ha8, m) | |
284 | h17.Size = creczvec(3) | |
285 | h17.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, xbu(4)) | |
286 | local h18 = cp(h16, m) | |
287 | h18.BrickColor = BrickColor.new("Reddish brown") | |
288 | h18.CFrame = han.CFrame*CFrame.new(dbu, 0, -xbu(3)) | |
289 | local h19 = cp(h17, m) | |
290 | h19.BrickColor = BrickColor.new("Reddish brown") | |
291 | h19.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, dbu) | |
292 | local h20 = cp(h12, m) | |
293 | h20.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(3)) | |
294 | local h21 = cp(h12, m) | |
295 | h21.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, xbu(3)) | |
296 | local h22 = cp(h14, m) | |
297 | h22.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(4)) | |
298 | local h23 = cp(h14, m) | |
299 | h23.CFrame = han.CFrame*CFrame.new(-xbu(4), 0, xbu(3)) | |
300 | local h24 = cp(h14, m) | |
301 | h24.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(5)) | |
302 | local h25 = cp(h14, m) | |
303 | h25.CFrame = han.CFrame*CFrame.new(-xbu(5), 0, xbu(4)) | |
304 | local h26 = cp(h12, m) | |
305 | h26.Size = recxvec | |
306 | h26.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(6.5)) | |
307 | local h27 = cp(h12, m) | |
308 | h27.Size = reczvec | |
309 | h27.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(4)) | |
310 | local h28 = cp(h14, m) | |
311 | h28.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(8)) | |
312 | local h29 = cp(h14, m) | |
313 | h29.CFrame = han.CFrame*CFrame.new(-xbu(8), 0, xbu(4)) | |
314 | local h30 = cp(ha8, m) | |
315 | h30.Size = crecxvec(4) | |
316 | h30.CFrame = han.CFrame*CFrame.new(xbu(5), 0, -xbu(6.5)) | |
317 | local h31 = cp(ha8, m) | |
318 | h31.Size = creczvec(4) | |
319 | h31.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(5)) | |
320 | local h32 = cp(h30, m) | |
321 | h32.BrickColor = BrickColor.new("Reddish brown") | |
322 | h32.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(6.5)) | |
323 | local h33 = cp(h31, m) | |
324 | h33.BrickColor = BrickColor.new("Reddish brown") | |
325 | h33.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(3)) | |
326 | local h34 = cp(ha1, m) | |
327 | h34.BrickColor = BrickColor.new("Reddish brown") | |
328 | h34.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(9)) | |
329 | local h35 = cp(h34, m) | |
330 | h35.CFrame = han.CFrame*CFrame.new(-xbu(9), 0, xbu(4)) | |
331 | local h36 = cp(ha1, m) | |
332 | h36.BrickColor = BrickColor.new("Dark stone grey") | |
333 | h36.CFrame = han.CFrame*CFrame.new(xbu(2), 0, -xbu(7)) | |
334 | local h37 = cp(h36, m) | |
335 | h37.CFrame = han.CFrame*CFrame.new(xbu(1), 0, -xbu(6)) | |
336 | local h38 = cp(h36, m) | |
337 | h38.CFrame = han.CFrame*CFrame.new(0, 0, -xbu(5)) | |
338 | local h39 = cp(h36, m) | |
339 | h39.CFrame = han.CFrame*CFrame.new(-xbu(1), 0, -xbu(4)) | |
340 | local h40 = cp(h36, m) | |
341 | h40.CFrame = han.CFrame*CFrame.new(-xbu(2), 0, -xbu(3)) | |
342 | local h41 = cp(h36, m) | |
343 | h41.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, -xbu(2)) | |
344 | local h42 = cp(h36, m) | |
345 | h42.CFrame = han.CFrame*CFrame.new(-xbu(4), 0, -xbu(1)) | |
346 | local h43 = cp(h36, m) | |
347 | h43.CFrame = han.CFrame*CFrame.new(-xbu(5), 0, 0) | |
348 | local h44 = cp(h36, m) | |
349 | h44.CFrame = han.CFrame*CFrame.new(-xbu(6), 0, xbu(1)) | |
350 | local h45 = cp(h36, m) | |
351 | h45.CFrame = han.CFrame*CFrame.new(-xbu(7), 0, xbu(2)) | |
352 | bowp:add(ha1, ha2, ha3, ha4, ha5, ha6, ha7, ha8, ha9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24, h25, h26, h27, h28, h29, h30, h31, h32, h33, h34, h35, h36, h37, h38, h39, h40, h41, h42, h43, h44, h45) | |
353 | for i = 1,#bowp.dat do | |
354 | local w = Instance.new("Weld", bowp.dat[i]) | |
355 | w.Part0 = han | |
356 | w.Part1 = bowp.dat[i] | |
357 | w.C0 = han.CFrame:inverse() | |
358 | w.C1 = bowp.dat[i].CFrame:inverse() | |
359 | end | |
360 | local s1 = Instance.new("Sound", han) | |
361 | s1.Name = "shotsound" | |
362 | s1.Pitch = 1.2 | |
363 | s1.SoundId = sid[1] | |
364 | s1.Volume = 1 | |
365 | local s2 = Instance.new("Sound", han) | |
366 | s2.Name = "arrowsound" | |
367 | s2.Pitch = 1.2 | |
368 | s2.Volume = 1 | |
369 | s2.SoundId = sid[2] | |
370 | rg = Instance.new("Weld", ra) | |
371 | rg.Name = "RightGripC" | |
372 | rg.Part0 = ra | |
373 | rg.Part1 = han | |
374 | rg.C0 = CFrame.new(0, -.75, 0) | |
375 | rg.C1 = CFrame.new(0, 0, 0)*CFrame.fromEulerAnglesXYZ(-math.rad(90), -math.rad(90),0) | |
376 | m.Parent = char | |
377 | end | |
378 | ||
379 | function removebow() | |
380 | rg:remove() | |
381 | rg = nil | |
382 | m:remove() | |
383 | han = nil | |
384 | m = nil | |
385 | end | |
386 | ||
387 | function carrow(head, ms) | |
388 | if noarrow then return end | |
389 | noarrow = true | |
390 | local un = head.Size.z/2 | |
391 | local am = Instance.new("Model") | |
392 | am.Name = "Arrow" | |
393 | local a1 = Instance.new("Part", am) | |
394 | Instance.new("BlockMesh", a1).Scale = Vector3.new(0, 1, 1) | |
395 | a1.Name = "shaft" | |
396 | a1.Transparency = 1 | |
397 | a1.FormFactor = 3 | |
398 | a1.TopSurface = 0 | |
399 | a1.BottomSurface = 0 | |
400 | local a1d1 = Instance.new("Decal", a1) | |
401 | a1d1.Face = "Right" | |
402 | a1d1.Texture = mid[1] | |
403 | local a1d2 = Instance.new("Decal", a1) | |
404 | a1d2.Face = "Left" | |
405 | a1d2.Texture = mid[2] | |
406 | a1.Size = Vector3.new(.2, .6, 2) | |
407 | a1.CFrame = CFrame.new((head.CFrame).p+Vector3.new(0,(head.Size.y/2)+2, 0), ms)*CFrame.fromEulerAnglesXYZ(0, 0, math.rad(45)) | |
408 | local s2 = han:FindFirstChild("arrowsound") | |
409 | local s2c = nil | |
410 | if (s2~=nil) then | |
411 | s2c = s2:clone() | |
412 | s2c.Parent = a1 | |
413 | s2c.Pitch = math.random(.8,1.2) | |
414 | end | |
415 | local s1 = han:FindFirstChild("shotsound") | |
416 | if (s1~=nil) then | |
417 | s1.Pitch = math.random(.8,1.2) | |
418 | s1:Play() | |
419 | end | |
420 | local a2 = a1:clone() | |
421 | a2.CFrame = a1.CFrame*CFrame.fromEulerAnglesXYZ(0, 0, -math.rad(90)) | |
422 | local we = Instance.new("Weld", a2) | |
423 | we.Part0 = a1 | |
424 | we.Part1 = a2 | |
425 | we.C0 = a1.CFrame:inverse() | |
426 | we.C1 = a2.CFrame:inverse() | |
427 | a2.Parent = am | |
428 | local a3 = Instance.new("Part", am) | |
429 | Instance.new("BlockMesh", a3).Scale = Vector3.new(1, 1, 0) | |
430 | a3.Name = "back" | |
431 | a3.Transparency = 1 | |
432 | a3.FormFactor = 3 | |
433 | a3.TopSurface = 0 | |
434 | a3.BottomSurface = 0 | |
435 | local a3d = Instance.new("Decal", a3) | |
436 | a3d.Face = "Front" | |
437 | a3d.Texture = mid[3] | |
438 | local a3d = Instance.new("Decal", a3) | |
439 | a3d.Face = "Back" | |
440 | a3d.Texture = mid[3] | |
441 | a3.Size = Vector3.new(.6, .6, .2) | |
442 | a3.CFrame = a1.CFrame*CFrame.new(0, 0, .9) | |
443 | local w3 = Instance.new("Weld", a3) | |
444 | w3.Part0 = a1 | |
445 | w3.Part1 = a3 | |
446 | w3.C0 = a1.CFrame:inverse() | |
447 | w3.C1 = a3.CFrame:inverse() | |
448 | local alreadyhit = false | |
449 | con=a1.Touched:connect(function(hit) | |
450 | if (hit:IsDescendantOf(p.Character)) then return end | |
451 | if alreadyhit then | |
452 | con:disconnect() | |
453 | return | |
454 | end | |
455 | if hit.CanCollide then | |
456 | if (hit~=head) then | |
457 | if (hit.Parent~=workspace) then | |
458 | for _,v in pairs(hit.Parent:GetChildren()) do | |
459 | if (v:IsA("Humanoid")) then | |
460 | if (v.Health<(damage+1)) then | |
461 | hit.Parent:BreakJoints() | |
462 | local tag1 = Instance.new("StringValue", v) | |
463 | tag1.Name = "DamageTag" | |
464 | tag1.Value = p.Name | |
465 | local tag2 = Instance.new("StringValue", v) | |
466 | tag2.Name = "WeaponTag" | |
467 | tag2.Value = "Minecraft Bow" | |
468 | else | |
469 | v.Health = v.Health-damage | |
470 | for i,w in pairs(hit.Parent:GetChildren()) do | |
471 | if (w:IsA("Part")) then | |
472 | for j = 1,6 do | |
473 | local nd = Instance.new("Decal", v) | |
474 | nd.Texture = mid[6] | |
475 | nd.Transparency = .5 | |
476 | nd.Face = j-1 | |
477 | coroutine.resume(coroutine.create(function() | |
478 | wait(.7) | |
479 | nd:remove() | |
480 | end)) | |
481 | end | |
482 | end | |
483 | end | |
484 | end | |
485 | end | |
486 | end | |
487 | end | |
488 | a1.CFrame = CFrame.new((a1.CFrame).p, Vector3.new(a1.CFrame.x, hit.CFrame.y, a1.CFrame.z)) | |
489 | local nw = Instance.new("Weld", a1) | |
490 | nw.Part0 = hit | |
491 | nw.Part1 = a1 | |
492 | nw.C0 = hit.CFrame:inverse() | |
493 | nw.C1 = a1.CFrame:inverse() | |
494 | coroutine.resume(coroutine.create(function() | |
495 | wait(10) | |
496 | am:remove() | |
497 | end)) | |
498 | if (s2c~=nil) then | |
499 | s2c:Play() | |
500 | end | |
501 | alreadyhit = true | |
502 | con:disconnect() | |
503 | end | |
504 | end | |
505 | end) | |
506 | con2=a2.Touched:connect(function(hit) | |
507 | if (hit:IsDescendantOf(p.Character)) then return end | |
508 | if alreadyhit then | |
509 | con2:disconnect() | |
510 | return | |
511 | end | |
512 | if hit.CanCollide then | |
513 | if (hit~=head) then | |
514 | if (hit.Parent~=workspace) then | |
515 | for _,v in pairs(hit.Parent:GetChildren()) do | |
516 | if (v:IsA("Humanoid")) then | |
517 | if (v.Health<(damage+1)) then | |
518 | hit.Parent:BreakJoints() | |
519 | local tag1 = Instance.new("StringValue", v) | |
520 | tag1.Name = "DamageTag" | |
521 | tag1.Value = p.Name | |
522 | local tag2 = Instance.new("StringValue", v) | |
523 | tag2.Name = "WeaponTag" | |
524 | tag2.Value = "Minecraft Bow" | |
525 | else | |
526 | v.Health = v.Health-damage | |
527 | for i,w in pairs(hit.Parent:GetChildren()) do | |
528 | if (w:IsA("Part")) then | |
529 | for j = 1,6 do | |
530 | local nd = Instance.new("Decal", w) | |
531 | nd.Texture = mid[6] | |
532 | nd.Transparency = .5 | |
533 | nd.Face = j-1 | |
534 | coroutine.resume(coroutine.create(function() | |
535 | wait(.7) | |
536 | nd:remove() | |
537 | end)) | |
538 | end | |
539 | end | |
540 | end | |
541 | end | |
542 | end | |
543 | end | |
544 | end | |
545 | a1.CFrame = CFrame.new((a1.CFrame).p, Vector3.new(a1.CFrame.x, hit.CFrame.y, a1.CFrame.z)) | |
546 | local nw = Instance.new("Weld", a1) | |
547 | nw.Part0 = hit | |
548 | nw.Part1 = a1 | |
549 | nw.C0 = hit.CFrame:inverse() | |
550 | nw.C1 = a1.CFrame:inverse() | |
551 | coroutine.resume(coroutine.create(function() | |
552 | wait(10) | |
553 | am:remove() | |
554 | end)) | |
555 | if (s2c~=nil) then | |
556 | s2c:Play() | |
557 | end | |
558 | alreadyhit = true | |
559 | con2:disconnect() | |
560 | end | |
561 | end | |
562 | end) | |
563 | coroutine.resume(coroutine.create(function() | |
564 | wait(12) | |
565 | if not alreadyhit then | |
566 | alreadyhit = true | |
567 | am:remove() | |
568 | end | |
569 | end)) | |
570 | local xr = math.random(velocityMin,velocityMax) | |
571 | a1.Velocity = a1.CFrame.lookVector*xr | |
572 | a2.Velocity = a1.CFrame.lookVector*xr | |
573 | a3.Velocity = a1.CFrame.lookVector*xr | |
574 | am.Parent = workspace | |
575 | coroutine.resume(coroutine.create(function() | |
576 | wait(delayTime) | |
577 | noarrow = false | |
578 | end)) | |
579 | end | |
580 | ||
581 | local h = Instance.new("HopperBin", p["Backpack"]) | |
582 | h.Name = "MCBow" | |
583 | h.TextureId = mid[5] | |
584 | ||
585 | h.Selected:connect(function(mos) | |
586 | equipped = true | |
587 | mos.Icon = mid[4] | |
588 | local hed = p.Character:FindFirstChild("Head") | |
589 | if (hed==nil) then return end | |
590 | createbow() | |
591 | mos.Button1Down:connect(function() | |
592 | carrow(hed, mos.Hit.p) | |
593 | end) | |
594 | h.Deselected:connect(function() | |
595 | mos.Icon = "rbxasset://textures\\ArrowFarCursor.png" | |
596 | end) | |
597 | end) | |
598 | ||
599 | h.Deselected:connect(function() | |
600 | equipped = false | |
601 | removebow() | |
602 | end) |