local function CheckGamepass(player) local success, boughtGamepass = pcall(function() return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 19990375) end)
if success and boughtGamepass then if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.Walkspeed = 75 else player.CharacterAdded:Wait() player.Character:WaitForChild("Humanoid") player.Character.Humanoid.Walkspeed = 75 end end
end game.Players.PlayerAdded:Connect(function(player) CheckGamepass(player) player.CharacterAdded:Connect(function(character) CheckGamepass(game.Players:GetPlayerFromCharacter(character)) end) end)
can anyone tell me why?
Capitalization for variables/properties matters!
You did not have the proper capitalization for the lines containing player.Character.Humanoid.WalkSpeed = 75:
-- This is correct: player.Character.Humanoid.WalkSpeed = 75 -- You had this: player.Character.Humanoid.Walkspeed = 75
This is the full script with the modifications made:
local function CheckGamepass(player) local success, boughtGamepass = pcall(function() return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 19990375) end) if success and boughtGamepass then if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.WalkSpeed = 75 else player.CharacterAdded:Wait() player.Character:WaitForChild("Humanoid") player.Character.Humanoid.WalkSpeed = 75 end end end game.Players.PlayerAdded:Connect(function(player) CheckGamepass(player) player.CharacterAdded:Connect(function(character) --CheckGamepass(game.Players:GetPlayerFromCharacter(character)) -- ^^ Not sure why you are getting the player from it's character... CheckGamepass(player) end) end)