#I keep getting "Unable to cast value to Object"

1 messages · Page 1 of 1 (latest)

ionic scarab
#

I already know how to do simple working teleportAsync. But after a while, I keep getting "Unable to cast value to Object". I tried everything, but nothing worked. I tried the most basic TeleportAsync which is

game.Players.PlayerAdded:Connect(function(plr)
TeleportService:TeleportAsync(place, plr)
end)

--Yes, I already made variables for TeleportService and place. And no, when I wrapped plr with {}, it said "response code is not 200"

I am going crazy rn and considering quitting. Like I'm so confused. It was working a while ago, but now it wont.

gilded goblet
#

if it was working a while ago maybe try it in the actual game instead of studio and also use a pcall for the teleport

#

add delay before the teleport aswell

ionic scarab
#

If it works, it should say "HTTP 403 (Forbidden)"

#

Added a delay and still didn't work

#

Tried it ingame and it failed

#

Checked to see if it's a player instance by printing it and it truly is

#

Used a pcall to and it said the same thing. Which is "Unable to cast value to objects".

ionic scarab
river pagodaBOT
#

studio** You are now Level 1! **studio

gilded goblet
#

Yea i have actually for this lobby i made. Lemme check rq what i did with it

ionic scarab
#

I got bored so I did this

gilded goblet
#

Im ngl i looked back at my code and the only difference was that i put the players in a table and put the table in the second arguement. Try the code in something else other than a plradded event to see if it works

ionic scarab
#

Said the same thing, Unable to blah blah

gilded goblet
#

just tested

local part = script.Parent

local TS = game:GetService("TeleportService")

part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
TS:TeleportAsync(135182600725576, {plr})
end
end)

only difference is plr gets teleported when they touch a part and it worked. So i think the problem isnt with the code you have. are both your games published to the public

ionic scarab
#

Connections only can access it

#

Friends*

#

Yeah I tried the same thing

gilded goblet
#

just tested it with playeradded aswell so its def not ur code just make sure everything is accessible outside studio

ionic scarab
#

I actually already tried that method and it said the same thing. Perhaps of the game settings? I tried each one but I don't know what to switch so I tried switching all on. (It failed)

gilded goblet
#

did you set the maturity age perhaps

ionic scarab
#

Yes

#

And other games too

#

I'm pretty sure you need to put an age rating before publisling it to public or friends only

#

But there's one weird thing

#

Something worked

#

Not the methods but another one

gilded goblet
#

which one

ionic scarab
#

Like the getting player from character

#

But not that one

#

It's my complex party teleporting system

#

Since nothing works, I just tried getting the leader to touch a part and teleport him and it works

#

Although I don't know how to make the members join

gilded goblet
#

X_X. So weird that it doesnt work for u, its working perfectly fine for me with same code u written. you kept the {} on the plr right?

ionic scarab
#

Sometimes it needs to, sometimes it doesn't

river pagodaBOT
#

studio** You are now Level 2! **studio

ionic scarab
#

I dont know

#

Others need to wrap it

#

While others dont

#

Even if it's already a table

gilded goblet
#

ye if its already a table maybe not but for plr wrap it since its not in one

#

But ye the code is fine this is an external issue probably

ionic scarab
#

Probably

#

It's my sister's laptop and the laptop got an error where the background turns pink

#

I tried testing polytoria and got a virus instead

gilded goblet
#

yikes thats not good

ionic scarab
#

I'm gonna get it fixed

#

So I'll take a break from development first

gilded goblet
#

well good luck on finding a solution and on getting ur laptop fixed

ionic scarab
#

Yeah thx

gilded goblet
#

I dont think you should take break unless u rlly want to just focus on other aspects but ur choice in the end

ionic scarab
#

I'm burned out from developing the game every day for 12 hours

#

Specially with the teleportasync problem