I developed a lucky block system which functions partially well. When a player opens it, they are supposed to receive an item, but currently, the items are not functioning and although they are equipped, they do not display in the game. I tried to move items in serverstorage replicatedfirst but nothing seems to work.
local Tool = script.Parent
local gears = game.ReplicatedFirst.Plus70:GetChildren()
local rand = math.random(1, #gears)
local equipped = false
function onActivated()
if not equipped then
return
end
gears[rand]:Clone().Parent = Tool.Parent
Tool:Destroy()
end
function onEquipped()
equipped = true
end
function Unequipped()
equipped = false
end
Tool.Activated:connect(onActivated)
Tool.Equipped:connect(onEquipped)
Tool.Unequipped:Connect(Unequipped)