game.Players.PlayerAdded:Connect(function(player) wait(1) local hasPass = false local success, message = pcall(function() hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) end) if hasPass == true or player.UserId == 94204218 then player.Character.Humanoid.WalkSpeed = 30 end
end)
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local GamepassId = --// Id local GamepassWalkspeed = 30 local GiveToIds = { [94204218] = true } local function SetWalkSpeed(Player) local HasPass = MarketplaceService:UserOwnsAssetAsync(Player.UserId, GamepassId) if (HasPass or GiveToIds[Player.UserId] then Player.CharacterAdded:Connect(function(Character) local Humanoid = Character:FindFirstChildOfClass("Humanoid") if (Humanoid) then Humanoid.WalkSpeed = GamepassWalkSpeed end end) end end Players.PlayerAdded:Connect(SetWalkSpeed)
Make a nested function that triggers every time the player's character respawns.
Try this:
game.Players.PlayerAdded:Connect(function(player) local AssetID = 123456789 -- Insert your AssetID here player.CharacterAdded:Connect(function(player) if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, AssetID) or player.UserId == 94204218 then player.Character.Humanoid.WalkSpeed = 30 end end) end)