I have my script to where if the object touching the part is a hat then end the script else if it has a humanoid then teleport it into the house
here's my house
script.Parent.Touched:connect(function(hit) if hit.Parent.Name == "Hat" then print'nope' elseif hit.Parent.Humanoid then local h = game.Players:findFirstChild(hit.Parent.Name) h.PlayerGui.Enter.Frame.Visible = true h.PlayerGui.Enter.Button.Visible = true else end end)
It looks like you want to see if there is an instance called "Humanoid" as a child of hit.Parent. You want your condition hit.Parent.Humanoid
to return nil if there is no humanoid there, but it's not actually safe to do this and an error will be thrown if there is no humanoid. Rather, hit.Parent:FindFirstChild("Humanoid")
will do what you want, returning the Humanoid if it can be found, and nil otherwise.