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

How do I fix this error?

Asked by 9 years ago

I made a script and asked script helping about it which I got that one answered about using clickdetector to teleport. But it didn't work since there was a error. This is the script and error:

Script:

s = game:service("TeleportService")
id = 74232401

function onClicked(player)
s:Teleport(id,player)
end

script.Parent.ClickDetector:connect(onClicked)


Error:

01:22:20.692 - connect is not a valid member of ClickDetector

Please help. Thank you, benthekarateboy :D

1 answer

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

Errors:

  • No such method as :service() for game. Use game:GetService("TeleportService") instead.

  • :connect() is a method for events, not an object. The conventional formula for a connection line is:

[Event]:connect([function])

Thus:

script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
Thanks bro :D User#5689 -1 — 9y
0
You're welcome. :) Redbullusa 1580 — 9y
Ad

Answer this question