Attempt to index nil with 'Clone'

Its a server script connected to a module script.
The “chosen” name is an exact match with the objects I’m trying to clone.
The only object successfully cloning is a part, the rest are meshes

local health =  script.Parent:GetAttribute("Health")
local db = true
local module = require(script.Parent.RandomDrops)
local SawBlades = game.ServerStorage.SawBlades


script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Handle" and db == true then
		db = false
		
		local damage = hit:GetAttribute("Damage")
		if damage == nil then
			print("Damage does not exist on this part")
			db = true
			return
		end
		health = health - damage
		script.Parent.Gui.hp.Text = health
		if health <= 0 then
			script.Parent.Gui.hp.Text = 0
			wait(.1)
			local chosen = module.Choose()
			
			if chosen == chosen then
				print(chosen)
				local clone = game.ServerStorage.SawBlades:FindFirstChild(chosen):Clone() --  Workspace.CommonCrate.Damage:26: attempt to index nil with 'Clone'
				clone.Parent = game.Workspace
				clone.Position = Vector3.new(script.Parent.Position.X, script.Parent.Position.Y, script.Parent.Position.Z)
				script.Parent:Destroy()
			end
		end
		wait(.7)
		db = true
	end
end)

The FindFirstChild() function likely isn’t finding “chosen”. Check the spelling. Check if “chosen” is a direct child of “SawBlades”

1 Like

Hey, i figured it out chosen was already finding the sawblade, so i just needed to clone chosen

1 Like