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.
What is the issue? The button will clone the weapon but the weapon stopped working.
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.
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.