player = game.Player.LocalPlayer
mouse = player:GetMouse()
firing = false
Canfire= true
reload = 5
damage = 35
rate = 5
script.Parent.Activated:connect(function()
if Canfire == true then
firing = true
repeat
local arrow = Instance.new("Part", workspace)
arrow.CanCollide = false
arrow.Shape = "Block"
arrow.Size = Vector3.new(0.4,0.4,0.4)
arrow.BrickColor = "Persimmon"
arrow.CFrame = CFrame.new(script.Parent.Handle.Position, mouse.Hit.p)
local v = Instance.new("BodyVelocity", arrow)
v.Velocity = arrow.CFrame.lookVector*50
game.Debris:AddItem(arrow,15)
arrow.Touched:connect(function(hit)
if hit.Parent ~= player.Character and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
arrow:Destroy()
end
end)
until firing == false
end
end)
script.Parent.Deactivated:connect(function()
if firing == true then
firing = false
end
end)
mouse.Keydown:connect(function(key)
Canfire = false
wait(reload)
Canfire = true
end)
I want it so the Bow sends a Projectile every time you click with a cooldown, as a result, nothing happens when I click with the bow. The Bow's handle is made of a union, I am only mentioning this because it might be the problem.
