Hello,
So I made a script with a lot of functions in it. But at the function;
tool.Equipped:Connect(function(player, mouse)
--- code
end)
Im getting this error;
![]()
This is the full script;
local prox = script.Parent
game.Players.PlayerAdded:Connect(function(player)
prox.TriggerEnded:Connect(function(player)
local ServerStorage = game:GetService("ServerStorage")
local screen = player.Backpack:FindFirstChild("Tool") or player.Character:FindFirstChild("Tool")
local wireCover = player.Backpack:FindFirstChild("MetalCover") or player.Character:FindFirstChild("MetalCover")
if screen then
screen.Equipped:Connect(function(player, mouse)
local screen_Clone = ServerStorage.Screen:Clone()
screen_Clone.Name = "Screen"
screen_Clone.Parent = game.Workspace.WorkshopGarage.Garage.Workshop.TopPartDesk
screen_Clone.Position = Vector3.new(575.5, 17.347, -71.25)
screen_Clone.Anchored = true
screen_Clone.Orientation = Vector3.new(0, 70, 90)
local originalScreen = player.Backpack:FindFirstChild("Tool") or player.Character:FindFirstChild("Tool")
originalScreen:Destroy()
end)
end
if wireCover then
wireCover.Equipped:Connect(function(player, mouse)
local metalCoverClone = ServerStorage.MetalCover:Clone()
metalCoverClone.Name = "WireCover"
metalCoverClone.Parent = game.Workspace.WorkshopGarage.Garage.Workshop.TopPartDesk
metalCoverClone.Position = Vector3.new(574.754, 17.318, -73.077)
metalCoverClone.Orientation = Vector3.new(0, -50, 0)
local originalCover = player.Backpack:FindFirstChild("MetalCover") or player.Character:FindFirstChild("MetalCover")
originalCover:Destroy()
end)
end
end)
end)