When I tested out this script for custom commands I got an error, the error is: "userID is not a valid member of Player". How would I fix this and make the commands work?
function onChatted(msg, speaker) local source = string.lower(speaker.Name) msg = string.lower(msg) if msg == "!respawn" then speaker:LoadCharacter() elseif msg == "!sparkles" then Instance.new("Sparkles", speaker.Character.HumanoidRootPart) elseif msg == "!ff" then Instance.new("ForceField", speaker.Character) elseif msg == "!run" then speaker.Character.Humanoid.WalkSpeed = 25 elseif msg == "!walk" then speaker.Character.Humanoid.WalkSpeed = 16 elseif msg == "!sit" then speaker.Character.Humanoid.Sit = true end end game.Players.PlayerAdded:connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userID, 5087872) then player.Chatted:connect(function(msg) onChatted(msg, player) end) end end)
UserId not userId