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

What is "Unable to cast string to int64"?

Asked by 7 years ago

Hello!

So I know that Roblox updated how GamePassService works, and I've been using one of their teleport models for ages, that worked just fine until the latest update. I thought I'd fixed my code here with the new terms, but I'm getting this error for Line 37 "Unable to cast string to int64" What is this? I've never seen this, and am unsure how to correct it.

Script below:

01--------------------
02--| WaitForChild |--
03--------------------
04 
05-- Waits for parent.child to exist, then returns it
06local function WaitForChild(parent, childName)
07    assert(parent, "ERROR: WaitForChild: parent is nil")
08    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
09    return parent[childName]
10end
11 
12-----------------
13--| Variables |--
14-----------------
15 
View all 69 lines...

1 answer

Log in to vote
2
Answered by
Avigant 2374 Moderation Voter Community Moderator
7 years ago
1if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, GamePassIdObject) then

MarketplaceService:UserOwnsGamePassAsync() takes two arguments, firstly, the player's User ID, and secondly an integer of the game pass ID to test ownership for.

http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/UserOwnsGamePassAsync

Also:

local GamePassIdObject = "rbxassetid://879190380"

You may be looking for this instead:

local GamePassIdObject = 879190380

0
Worked! :) Thank you for your assistance! Never2Humble 90 — 7y
Ad

Answer this question