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 = BrickColor.new(175,0,0) 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)
That is my script for firing from a Union Handled Tool, I have no idea what is wrong with it, I am a horrid scripter.
This is not an answer it is an correction.
When posting on this site all of your code should be in a code block
Also everything should be on separate lines and tabbed.
Now maybe this would make it easy to find your own error.
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)
Closed as Non-Descriptive by Goulstem
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?