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