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

Touched is not a valid member of Model??????

so im just making a door and this pops up in the output " Touched is not a valid member of Model" can someone help me

local doorModel = script.Parent

local TweenService = game:GetService("TweenService")
local doorTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

local leftDoorTween = TweenService:Create(doorModel.leftDoor, doorTweenInfo, {CFrame = doorModel.leftDoorOpen.CFrame})
local rightDoorTween = TweenService:Create(doorModel.rightDoor, doorTweenInfo, {CFrame = doorModel.rightDoorOpen.CFrame})

doorModel.Keyhole.Touched:Connect(function(hit)
	if hit.Parent:IsA("Tool") and hit.Parent.Name == "Key" then
		       leftDoorTween:Play()
		       rightDoorTween:Play()
		
	end
end)

can someone help

(p.s. im doing gnomecodes tuotorial for fun so yeah)

1 comment

0

It's as simple as the error says, touched simply isn't a valid member of the model class.

1 answer

you have to access a specific part, you cant access a model in general. I haven't tested this but I have ran into this problem before, making a specific part should do the trick. for what I think you should do, is you should make an invisible part that surrounds the touch area.

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