I try to create a gamepass that i can use in my game, but it doesnt work.
Here is the code
local gamepass = 10954412
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player.userId, gamepass) then
local h = character:WaitForChild("Humanoid")
h.WalkSpeed = 50
end
end)
end)
the output says
Unable to cast value to Object
Script 'Workspace.GamePass', Line 5

1 comment
Thankyou for your reply