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

Why is this giving me a seemingly generic errror?

Asked by 8 years ago

I have a teleportation script for a titlescreen of my game. When the event happens and the function is triggered. The error was this.

Unable to cast value to Object

script.Parent.MouseButton1Down:connect(function(player)
    local maingameid = 483825326
    local TeleportService = game:GetService("TeleportService")
    TeleportService:Teleport(player, maingameid)
end)

Can someone help me?

Please do not downvote without telling me why.

Will accept answer if it helps

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

MouseButton1Down does not return a player.

Ad

Answer this question