game.Players.PlayerAdded:Connect(function(player)
local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
if hasSpeedGamePass then
print(player.Name .. " owns the gamepass")
--Make a characterAdded conection
player.CharacterAdded:Connect(function(Character)
Character.Humanoid.WalkSpeed = 200
end)
end
end)
That means the hasSpeedGamePass boolean is not true, which means the connection will never be made. Check if the GamepassID is correct and if you are using the correct reference for MarketPlaceService, you can also check if hasSpeedGamePass is actually “false” and not nil.
Update: I tested the same script in-game and it worked completly fine for me.
local speedGamePassImageButton = script.Parent
local speedGamePassLabel = script.Parent.SpeedGamePassLabel
local marketPlace = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local gamePassID = 15190401
speedGamePassImageButton.MouseButton1Up:Connect(function()
marketPlace:PromptGamePassPurchase(player, gamePassID)
marketPlace.PromptGamePassPurchaseFinished:Connect(function(player, ID, wasBought)
if wasBought and ID == gamePassID then
print(marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID))
player.Character:WaitForChild("Humanoid").WalkSpeed = 200
speedGamePassLabel.Text = "Successfully bought speed gamepass!"
wait(3)
speedGamePassLabel.Text = "If you buy the speed gamepass, you will be granted extra speed!"
end
end)
end)
game.Players.PlayerAdded:Connect(function()
local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
if hasSpeedGamePass then
print(player.Name .. " owns the gamepass")
--Make a characterAdded conection
player.CharacterAdded:Connect(function(Character)
Character.Humanoid.WalkSpeed = 200
end)
end
end)
Oh wait I think I know the problem. I’m not sure if this will run any different then what you already did but on my game it works, so maybe it will here.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
char.Humanoid.WalkSpeed = 50
end
end)
end)
What you did was you made a local Boolean variable that checks if the user owns the gamepass, and then using that value you made an if statement. In this script, if they own the gamepass then it instantly runs the script.
local speedGamePassImageButton = script.Parent
local speedGamePassLabel = script.Parent.SpeedGamePassLabel
local marketPlace = game:GetService("MarketplaceService")
local gamePassID = 15190401
game.Players.PlayerAdded:Connect(function(player)
speedGamePassImageButton.MouseButton1Up:Connect(function()
marketPlace:PromptGamePassPurchase(player, gamePassID)
marketPlace.PromptGamePassPurchaseFinished:Connect(function(player, ID, wasBought)
if wasBought and ID == gamePassID then
print(marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID))
player.Character:WaitForChild("Humanoid").WalkSpeed = 200
speedGamePassLabel.Text = "Successfully bought speed gamepass!"
wait(3)
speedGamePassLabel.Text = "If you buy the speed gamepass, you will be granted extra speed!"
end
end)
end)
local hasSpeedGamePass = marketPlace:UserOwnsGamePassAsync(player.UserId, gamePassID)
if hasSpeedGamePass then
print(player.Name .. " owns the gamepass")
--Make a characterAdded conection
player.CharacterAdded:Connect(function(Character)
Character.Humanoid.WalkSpeed = 200
end)
end
end)
local Player = game.Players.LocalPlayer
local gamePassID = 15190401
local MarketPlace = game:GetService("MarketplaceService")
Player.CharacterAdded:Connect(function()
if MarketPlace:UserOwnsGamePassAsync(Player.UserId, gamePassId) then
Player.Character.Humanoid.WalkSpeed = 200
print(Player.Name.." has the gamepass")
end
end)
Also make sure that API Services/HTTP Requests are turned on