Walkspeed gamepass script, not sure why it isn’t working. I followed an AlvinBlox tutorial for this.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if game.MarketplaceService:PlayerOwnsAsset(player,18375850) then
character.Humanoid.WalkSpeed = 24
end
end)
end)
pcall does not solve the issue in this context. They only shield the scripts from completely breaking because of an endpoint failure. Although not exactly the solution, it would be trivial and optional to apply pcall.
local GamepassId = 12345678 -- ID here
local MarketPlaceService = game:GetService("MarketPlaceService")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if MarketPlaceService:UserOwnsGamepassAsync(player.UserId,GamepassId) then
Character.Humanoid.WalkSpeed = 0 -- Number Here
end
end)
end)
This method should not be used for game passes, since they use a separate ID system. Legacy game passes that still depend on an asset ID should use GamePassService:PlayerHasPass (which is old, don’t use.) instead of this method.
This method cannot be used to check for developer products since they can be purchased multiple times but not owned themselves. Use a GlobalDataStore to save when a developer has bought a developer product instead.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
if game.MarketplaceService:UserOwnsGamePassAsync(Player.UserId, Here) then --- Place ID where i said here
Char.Humanoid.WalkSpeed = 0
end
end)
end)
That should work but why not place a script in PlayerCharacterScripts
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local id = 00000
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
Char.Humanoid.WalkSpeed = 0
end
I edited your script a bit it worked for me in my game I put it in StarterScriptService with a Script and Used this Code that I edited from yours.
local MPS = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MPS:UserOwnsGamePassAsync(player.UserId,4583776) then
character.Humanoid.WalkSpeed = 24
end
end)
end)