Hi I am trying to create a clone of the object, however, the clone seems to be nil…?
Here is my code:
server:
game.ReplicatedStorage.Events.UseItem.OnServerEvent:Connect(function(item, playerid)
local itemname = game.ServerStorage.Items:FindFirstChild(item)
local itemclone = itemname:Clone()
itemclone.Parent = game.Workspace
end)
Local:
local function UseItem(item, playerid)
game.ReplicatedStorage.Events.UseItem:FireServer(item, playerid)
end
mouse.KeyDown:Connect(function(key)
if key == "e" then
if player:FindFirstChild("CurrentItem").Value ~= "None" then
if player:FindFirstChild("CurrentItem").Value == "Oil Spill" then
print("Player has oil")
UseItem("OilSpill", player.UserId)
end
end
end
end)