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? plz help

Asked by 7 years ago

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)
0
Is the object of "StartFinish" a part or model? FiredDusk 1466 — 7y
0
its a part criller7070 6 — 7y
0
its is acutualy a model criller7070 6 — 7y
0
Well, you can use a touched event on a model, it only works on a part. FiredDusk 1466 — 7y
View all comments (4 more)
0
ok thx criller7070 6 — 7y
0
So, make a part in "StartFinish" called "Main" and after "StartFinish" on line 1, add ".Main" after. FiredDusk 1466 — 7y
0
Thx it worked answer the question so i can confirm the answer criller7070 6 — 7y
0
just type something it dont matter criller7070 6 — 7y

2 answers

Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
7 years ago

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.

Ad
Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
7 years ago
Edited 7 years ago

You can't use a Touchedevent 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)

Answer this question