"if" script not properly functioning

I want to make it so that if the model listed is a “Model” instance, it would do a unique action. If it’s a “Sound”, it would play.

the problem is that It only acknowledges the first “if” script.

ive tried looking in the forum.

pcall(function()
   			local h = obj:Clone()
   			if h.ClassName == "Part" or "Model" then
   			script.Parent.Parent.Character.Head.spawn_object2:Play()
   			h.Parent = game.workspace
   			h:TranslateBy(script.Parent.Parent.Character.Head.Position)--Change the speed to moving	
   			end
   			if h.ClassName == "Tool" then
   			h.Parent = script.Parent.Parent.Character
   	end
   			if h.ClassName == "Script" or "LocalScript" or "ModuleScript" then
   			h.Disabled = false
   			h.SCRIPTHELPER.Disabled = false
   			end
   	end)

you need to put the full phrase for each check so it the 1st if line would be:

if h.ClassName == "Part" or h.ClassName == "Model" then

the 2nd:

if h.ClassName == "Script" or h.ClassName == "LocalScript" or h.ClassName == "ModuleScript" then
4 Likes

You’re also using the pcall global improperly, due to its significant performance impact it should only be used as a last resort.