My bow WAS working but now it won't

  1. What do you want to achieve? A working bow

  2. What is the issue? My bow was working but when I moved it out of starter pack into a text button so that I could give it to other players when they clicked the button it stopped working.

  3. What solutions have you tried so far? I have tried DevForum and Adjusting the code

My code so far:
local tool = script.Parent
local handle = tool:WaitForChild(‘Handle’)
local event = tool:WaitForChild(‘RemoteEvent’)
local debounce = true
local CoolDownTime = 3
local Arrow = game.ReplicatedStorage.Arrow
event.OnServerEvent:connect(function(player,pos)
local newArrow = Arrow:clone()
local humanoid = tool.Parent:FindFirstChildWhichIsA(‘Humanoid’)
if humanoid and humanoid.Health > 0 and debounce == true then
debounce = false
local newArrow = Arrow:Clone()
newArrow.Parent = workspace
newArrow.CanCollide = false
newArrow.CFrame = CFrame.new(handle.Position,pos)
local Velocity = Instance.new(‘BodyVelocity’)
Velocity.Parent = newArrow
Velocity.Velocity = newArrow.CFrame.LookVector.Unit*300
Velocity.MaxForce = Vector3.new(‘inf’, ‘inf’, ‘inf’)
newArrow.Touched:connect(function(hit)
local human = hit.parent:FindFirstChildWhichIsA(‘Humanoid’)
if human and human.health > 0 and human ~= humanoid then
human:takedamage(20)
newArrow.destroy()
elseif not human and hit.CanCollide == true and not hit:IsDescendantOf(humanoid.parent) and not hit:IsDescendantOf(tool) then
if Velocity then
Velocity:Destroy()
end
local weld = Instance.new(‘WeldConstraint’)
weld.Parent = newArrow
weld.Part0 = newArrow
weld.Part1 = hit
Arrow.Massless = true
newArrow.CanCollide = false
end
end)
game.Debris:AddItem(newArrow, 5)
wait(CoolDownTime)
debounce = true
end
end)

Please help me, ASAP All help appreciated thank you for reading this and if you help out also thanks.

And also I do have an arrow as well. It is in rep storage. Just a model.

You need to duplicate the tool and give it to the player through a server script and a remote event for it.

@Spellwastaken Would you mind explaining that further please? I just started coding 1 -2 weeks ago. I only know some basics and how to make weapons, guis and animations.

You need to duplicate the tool using tool:Clone() whether that be in a GUI script or whatever is giving you the tool (Or you could parent it to the player’s backpack if you always want them to have the bow) and then you have to make a remote event in replicated storage and use :OnServerEvent() to detect when the remote event fires when you fire it through the GUI script or whatever you have giving you the tool and then when that fires it puts it to the player backpack. Reply to me if you need more information.

@ItsTruckYear I already cloned the tool and tried the onserver event. It gives the bow to the player but the BOW itself doesnt work, even though it does in the starter pack.

oh ok i dont rlly work with tools but i can definitely look into it and get back to you if u want

Ok thank you for looking into it if you find anything please let me know I will rlly appreciate it.

1 Like