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

7 comments

0

Please use code blocks.

0

use this code i just uppdated it slightly let me make it better as well

0

And what is this script type? Is it a server script, is it a local script? What line is your error on?

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.

0

What's a normal script?

0
0

rip code block