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

what does unable to cast value to object mean?

Asked by 5 years ago

so im trying to make a gamepass "door", and for whatever reason im getting the unable to cast value to object error, here is my script, keep in mind I have other local variables above

local hasgamepass = false local function OnTouched(otherPart) if otherPart and otherPart.Parent and otherPart.Parent:FindFirstChild('Humanoid') then local player = PlayersService:GetPlayerFromCharacter(otherPart.Parent) if player and not JustTouched[player] then JustTouched[player] = time() if hasgamepass == false then GamePassService:PromptGamePassPurchase(game.Players.LocalPlayer.UserId, 4795082) end if GamePassService:UserOwnsGamePassAsync(player.userId, script.GamePassId.Value) then TeleportToOtherSide(player.Character, otherPart) local hasgamepass = true end end end end

0
Please use code blocks. User#19524 175 — 5y
0
use this code i just uppdated it slightly let me make it better as well BingBangBrine -5 — 5y
0
And what is this script type? Is it a server script, is it a local script? What line is your error on? User#19524 175 — 5y
0
just a normal script, error on line 53 and also how do i use code blocks in this, sorry im new to this site. BingBangBrine -5 — 5y
View all comments (3 more)
0
What's a normal script? User#19524 175 — 5y
0
https://gyazo.com/22157f7f1443854226575179778259dd This is how to format scripts. User#19524 175 — 5y
0
rip code block User#17685 0 — 5y

Answer this question