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

I fixed the other generic error, and then get surprised with another error. Why?

I fixed yesterday's error by using a localscript and referencing

game.Players.LocalPlayer to get the player. This fixed the problem, I was only rewarded another error, I looked online for this and got no hope.

Error:

Unable to cast Instance to Int

Script:

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

Help Is Appreciated

PLEASE DO NOT DOWNVOTE WITHOUT TELLING ME WHAT TO DO DIFFERENTLY WITH MY QUESTION

Will Accept Answer If It Helped Me

1 answer

[CLOSED] I figured it out, apparently I misplaced the parameters that TeleportService accepts.

Fixed Script:

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

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