So i have multiple Gui buttons that navigate through the menu and i have MouseButton1Click's to do that. Then i have one that is supposed to give your a tool, however that one button doesnt even register its being clicked.
Heres my code for the tool button
local storage = game:GetService("ServerStorage") local greatSword = storage.GreatSword:Clone() function leftClick(plr) print("equip") greatSword.Parent = plr.Backpack script.Parent.Visible = false end script.Parent.MouseButton1Click:Connect(leftClick)
And this is the code for the normal navigation buttons
script.Parent.Parent.Parent.Weapons.Visible = false function leftClick() script.Parent.Parent.Visible = false script.Parent.Parent.Parent.Weapons.Visible = true end script.Parent.MouseButton1Click:Connect(leftClick)
The important bits are the functions, i am fairly new to roblox's language of scripting so it could be a simple mistake but i just cant figure out when they both are using the same function code but the tool button one just wont work while the other does.
Also they are buth under frames in the ScreenGui
Figured it out, just needed to move the tool into replicated storage and add a waitforchild before getting the tool from the storage, because what was happening is it was looking for the tool before it was loaded in so it would lock the script.
Thanks to 9mze for the tip