So I wanna make a part that when it’s clicked it will give a tool and when it’s clicked again it will take the tool away from the player but I get this error could somebody help?
Here is the script:
local Clone = game.ServerStorage.Product:Clone()
local part = script.Parent
part.MouseClick:Connect(function(player)
if part.Parent.Transparency == 0 then
Clone.Parent = player.Backpack
part.Parent.Transparency = 1
else
part.Parent.Transparency = 0
player.Backpack.Product:Destroy()
end
end)
local part = script.Parent
part.MouseClick:Connect(function(player)
local Clone = game.ServerStorage.Product:Clone()
if part.Parent.Transparency == 0 then
Clone.Parent = player.Backpack
part.Parent.Transparency = 1
else
part.Parent.Transparency = 0
player.Backpack.Product:Destroy()
end
end)
You have to make the clone in the mouse click event!