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

Touched is not a valid member of Model? plz help

when i click play it says "Touched is not a valid member of Model" can you help me

local checkpoint1 = game.Workspace.StartFinish
local checkpoint2 = game.Workspace.Checkpoint1
local checkpoint3 = game.Workspace.Checkpoint2
local checkpoint4 = game.Workspace.Checkpoint3


function checkpoint1hit()
	print("Checkpoint1 was hit!")
end


checkpoint1.Touched:connect(checkpoint1hit)

8 comments

0

Is the object of "StartFinish" a part or model?

0

its a part

0

its is acutualy a model

0

Well, you can use a touched event on a model, it only works on a part.

0

ok thx

0

So, make a part in "StartFinish" called "Main" and after "StartFinish" on line 1, add ".Main" after.

0

Thx it worked answer the question so i can confirm the answer

0

just type something it dont matter

2 answers

✓ Accepted answer

checkpoint1 is, in fact, a Model, otherwise the error would not have been generated.

The Touched event is not defined for models, so you'll have to use the Touched event of a Part, probably a Part inside your model.

You can't use a Touched event on a model, it only works on a part.

To make this work, make a part in "StartFinish" called "Main" and after "StartFinish" on line 1, add ".Main" after.

local checkpoint1 = game.Workspace.StartFinish.Main --added here
local checkpoint2 = game.Workspace.Checkpoint1
local checkpoint3 = game.Workspace.Checkpoint2
local checkpoint4 = game.Workspace.Checkpoint3


function checkpoint1hit()
    print("Checkpoint1 was hit!")
end


checkpoint1.Touched:connect(checkpoint1hit)

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