The weapon appears on studio but not on the game itself when it is cloned to the character
EDIT: Here is my equip script
player = game.Players.LocalPlayer
playerinWorkspace = player.Character.Name
inventory = script.Parent.Parent
inv_shown = false
local itemtoReplace
function replace()
local item = script.Parent.theItem.Value
print(itemtoReplace)
if item then
if item.itemEquipped.Value == true then
print("This is already equipped")
else
if item.itemType.Value == "Weapon" then
for j,k in pairs(player.Equip:GetChildren()) do
if k.itemType.Value == "Weapon" then
local itemName = k.Name
k:Destroy()
end
end
wait()
print("lmao1")
local itemtoEquip = item:Clone()
itemtoEquip.Parent = player.Equip
item.itemEquipped.Value = true
itemtoReplace.itemEquipped.Value = false
itemtoReplace = item
end
end
end
end
function itemEquip()
local item = script.Parent.theItem.Value
if item then
if item:findFirstChild("itemLevel") then
if player.Stats.Lvl.Value < item.itemLevel.Value then
print("Put Errror Here")
end
end
local found_wep = false
if item:findFirstChild("itemType") then
if item.itemType.Value == "Weapon" then
for j,k in pairs(player.Equip:GetChildren()) do
if k.itemType.Value == item.itemType.Value then
found_wep = true
end
end
for j,k in pairs(player.Character:GetChildren()) do
if k.ClassName == "Tool" then
if k.itemType.Value == item.itemType.Value then
found_wep = true
end
end
end
if found_wep == false then
item.itemEquipped.Value = true
itemtoReplace = item
local clon = item:Clone()
clon.Parent = player.Equip
itemtoReplace = item
script.Parent.Visible = false
else
print("Replace? Message")
replace()
script.Parent.Visible = false
end
end
end
end
function Throw()
local item = script.Parent.theItem.Value
if item:findFirstChild("itemType") then
if item.itemType.Value == "Weapon" then
for j,k in pairs(player.Equip:GetChildren()) do
if k.itemType.Value == item.itemType.Value then
k:Destroy()
item:Destroy()
script.Parent.Visible = false
end
end
end
end
end
script.Parent.Equip.MouseButton1Click:connect(itemEquip)
script.Parent.Throw.MouseButton1Click:connect(Throw)
tried manually copying a working weapon into inventory and it works fine but using scripts to copy a weapon from the lighting to the inventory makes it broken

1 comment
Use Connect, not connect. Use FindFirstChild, not findFirstChild. Scripting is case sensitive, buddy.