Why do I get 2 weapons when I press a button

  1. What do you want to achieve? A button that gives ONE weapon
  2. What is the issue? The button gives 2 weapons.
  3. What solutions have you tried so far? Editing the code and looking on the devForum

My Code so far:

local Event = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

Event.OnServerEvent:Connect(function(Player, ToolName)
local Tool = game.ServerStorage:WaitForChild(ToolName)
local ToolClone1 = Tool:Clone()

ToolClone1.Parent = Player.Backpack
print("hi")	

end)

The print Hi was to see if it was printed twice but it was printed only once.
If you could help that would be great and if you read this also thank you.

1 Like

try to add Wait(1) after local ToolClone1

1 Like

It gave me 1 wand then a sec later the other wand came.

1 Like

Where’s the script that calls this event? maybe the problem is in there

Got it to work thank you monstergames. All i had to do was delete the second script.

This is unnecessary to the script and was giving a duplicate.

oh that’s fine happy to you + you mean ty Sorbious

No thank you @MONSTERGAMES3609 you helped me realize the script after wait wasn’t needed.

Actually @Sorbious and @MONSTERGAMES3609 it stopped working I don’t know why this is.

local Event = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

Event.OnServerEvent:Connect(function(Player, ToolName)
local Tool = game.ServerStorage:WaitForChild(ToolName)
local ToolClone1 = Tool:Clone()
wait(1)
ToolClone1.Parent = Player.Backpack
end)

I think this will work ima test it.

1 Like

Show us the script that call the event

This is not the unnecessary to the script because this is the part that gives the cloned tool to the player.

Lemme see the localscript of the button that calls this event.

Yea I think the problem in it .

For the wand or the archer? or both?

local RemoteEvent = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

local Button = script.Parent

Button.MouseButton1Down:Connect(function()

RemoteEvent:FireServer(“BeginnerWand”)

Button.Parent.Visible = false

end)

and for the bow

local RemoteEvent = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

local Button = script.Parent

Button.MouseButton1Down:Connect(function()

RemoteEvent:FireServer(“Bow”)

Button.Parent.Visible = false

end)

if theyre the same scripts but different in values then just choose one.

make them in preformatted to make it better

in the website there is a preformatted button select the script in the website and click on the preformatted button to make script easier to see

like this

script.Parent.Mouse

Where should I put the script?