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

How do I fix this error?

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

✓ Accepted answer

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)

2 comments

0

Thanks bro :D

0

You're welcome. :)

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