My bow stopped working Need Further explanation please

  1. What do you want to achieve? I want to make a button that can clone a weapon and give it to the player who clicked it.

  2. What is the issue? The button will clone the weapon but the weapon stopped working.

  3. What solutions have you tried so far? I have tried the dev hub and even made my own post.

Someone suggested duplicating the tool, giving the player the weapon through a script and making a remote function for it. I don’t understand this because I have only 1 - 2 week of experience. Can Someone please explain this a bit more clearer please? Thank you for reading this and if you helped me solve this problem also thank you.
My code so far:
local p = game.Players.LocalPlayer

script.Parent.MouseButton1Up:Connect(function()

local tool = script.Parent.Bow:Clone()

tool.Parent = p.Backpack

script.Parent.Parent.Visible = false

end)

This makes the frame disappear and give the (not working) weapon to the player. While it was in starter pack it worked but when I gave it to the player using a local script it stopped working. Please help me ASAP.

is there any errors in the output? that could be the solution to 99% of your problems

RemoteEvent is not a valid member of TextButton “Players.crazyEjai.PlayerGui.ScreenGui.Frame.Archer”

@PostVivic this was the error I found in the output.

can you please click the output error then post the script area its in?

but it appears that your trying to call a remote event that doesnt exist

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
script.Parent.Bow:Clone().Parent = plr.Backpack
end)

The first line is giving me the error.

put a remote event in the button beside the script, also if you need to add additional info you can edit your original post instead of replying

Could you further explain that please?

you have a remote event

script.Parent.RemoteEvent.OnServerEvent:Connect(function(
	--the remote event thing doesnt exist, thats why its calling the error
end)

so you should make it exist by under the button that the script is in putting a remote event named “RemoteEvent”

I added remote functions in multiple places and it fixed the error but the bow won’t work anymore. (It worked before in the starter pack)

are there any other errors that happen?

I received another message that said this.

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.

can you send me the model file for the bow? (right click the bow itself and click save to file then upload that)

Bow file I guess.rbxm (45.2 KB)

image
you need a remote event in the tool like this

I also touched up the serverscript one bit by removing a stray Arrow:Clone() which will result in 2 instances being created

bowfile.rbxm (45.4 KB)

edit:the remote event was telling the client to fire a signal to the server. when you didn’t put it in, it didn’t exist and it errored

I put one in the bow now what?

does it work? if not please provide the output and the error (btw it worked for me)

No error it might be that stray arrow clone. How do I fix that? I didn’t edit the script to remove it.

the stray error clone was just where you did

local newarrow = Arrow:Clone()

then did an if statement and after that

local newarrow = Arrow:Clone()

edit:try adding prints to see what the script actually does