Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

01local doorModel = script.Parent
02 
03local TweenService = game:GetService("TweenService")
04local doorTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
05 
06local leftDoorTween = TweenService:Create(doorModel.leftDoor, doorTweenInfo, {CFrame = doorModel.leftDoorOpen.CFrame})
07local rightDoorTween = TweenService:Create(doorModel.rightDoor, doorTweenInfo, {CFrame = doorModel.rightDoorOpen.CFrame})
08 
09doorModel.Keyhole.Touched:Connect(function(hit)
10    if hit.Parent:IsA("Tool") and hit.Parent.Name == "Key" then
11               leftDoorTween:Play()
12               rightDoorTween:Play()
13 
14    end
15end)

can someone help

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

0
It's as simple as the error says, touched simply isn't a valid member of the model class. SteamG00B 1633 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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.

Ad

Answer this question