Hello! I am trying to make a simple weapon selection system where the player is prompted to pick a weapon when they first join the game or die and respawn.
For whatever reason, new buttons don’t work. Adding new or copy/pasting existing buttons results in nothing happening. (The bottom 2 buttons in the video are the new ones that aren’t doing anything)
I have already looked to see if anybody has had a similar issue, but I can’t find something like this.
here is what the explorer looks like:
and here is the script:
local player = script.Parent.Parent.Parent
local backpack = player.Backpack
local serverStorage = game:GetService("ServerStorage")
function chooseClass(class)
local v = serverStorage:WaitForChild(class.Name)
v:clone().Parent = backpack
script.Parent.Main.C4:Clone().Parent = backpack
script.Parent.Main["[WIP] Grenade"]:Clone().Parent = backpack
script.Parent.Main["Bear Trap"]:Clone().Parent = backpack
script.Parent.Main.Visible = false
end
function onHumanoidDied(humanoid, player)
script.Parent.Main.Visible = true
end
for i, v in pairs(script.Parent.Main:GetChildren()) do
v.MouseButton1Up:connect(function () chooseClass(v) end)
end