Commented Line giving a Error "Unable to cast object"

image
image

Hello Developers!
so i’m having a problem here where my commented line is giving a error “Unable to cast value to Objects”, i’m so confused why this is happening because it’s a comment, it won’t run any. I comment the line because i’m updating something that is included to this commented line. I’m so confused if Roblox Studio is just having a bug because it might be in the other function that isn’t commented, so i assume it was here

game.ReplicatedStorage.play.OnServerEvent:Connect(function(player)
	local code = TeleportService:ReserveServer(game.PlaceId)
	TeleportService:TeleportToPrivateServer(game.PlaceId,code,player)
end)

so i tried searching to solve it to make it like this(Unable to cast value to Objects - Teleport Service - #2 by Thundermaker300):

game.ReplicatedStorage.play.OnServerEvent:Connect(function(player)
	local code = TeleportService:ReserveServer(game.PlaceId)
	TeleportService:TeleportToPrivateServer(game.PlaceId,code,{player})
end)

but it still give an error. (i have no report bug perms btw)

Thanks for helping out!

It’s possible that you commented the code in studio, but never published the game with that comment. However, are you positive that it is coming from that script and that specific bit?

i published it 2x to be sure and this is the only script in ServerScriptService
image

Can you try using directly the placeId, and not the game.PlaceId?

Also on the variable code

Summary

Charrrrrs

No problems on variables but it was the game.placeId, Thank you so much!

1 Like