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

what does "11:42:39.147 - Touched is not a valid member of Model" mean?

trying to script a key card door for a horror/adventure game, but i keep getting this error. what do i do and what does it mean?

script:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "Keycard" then
		script.Parent.CanCollide = false
		script.Parent.Transparency = 0.5
		wait(2)
		script.Parent.CanCollide = true
	end
end)

error message in output:

11:42:39.147 - Touched is not a valid member of Model

any help?

1 comment

0

Can you put the code into the lua block

1 answer

✓ Accepted answer

The script is probably inside a model - models do not act like parts and therefore cannot have a touched event.

Assuming that the part you want to have the touched event on is named "Door", you could do this:

script.Parent.Door.Touched:Connect(function(hit)
    if hit.Parent.Name == "Keycard" then
        script.Parent.Door.CanCollide = false
        script.Parent.Door.Transparency = 0.5
        wait(2)
        script.Parent.Door.CanCollide = true
    end
end)

3 comments

0

i have gotten this problem before when making games on my group when i was using events to fire things like i made a death run type game on my group and when making a kill brick this happened to me aswell

0

thanks for trying to help raccoon, but it didn't work. the door i had was originally a grouped model of multiple parts, so i thought it might be that. made it a singular part, nothing changed. :(

0

okay oh my god never mind it worked thank you

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