Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I add touched to model?

script.Parent.Touched:connect(function(h)
	if h.Parent.Name == "Basic Cakepop" or h.Parent.Name == "U" then
		h.Parent.Name = "White Cakepop"
		if h.Parent:FindFirstChild("drink") ~= nil then
			h.Parent.drink.Transparency = 0
			h.Parent.drink.BrickColor = BrickColor.new("White")
		end
	end
end)

I keep getting the Error "18:24:45.398 - Touched is not a valid member of Model"

1 answer

✓ Accepted answer

Models are simply meant to organize things, as it says in the wiki. That means the model doesn’t have the properties of a part, which also means it doesn’t have the .Touched function.

You can put an invisible, non-collidable part on the model so when players touch the part, stuff happens. You can also use .magnitude I think, but I would just prefer making the invisible part.

1 comment

0

... Sorry for wasting your time, just realized I just had the script grouped in a model, not inside a part/meshpart

This discussion is preserved as it was. New answers, comments, and votes are closed.