Error: "Cannot find player.userid" What would be the correct format for localscript? I've tried without userid
repeat wait(.1) until game.Players.LocalPlayer.Character ~= nil repeat wait(.1) until game.Players.LocalPlayer.Character.Humanoid ~= nil player = game.Players.LocalPlayer mouse = player:GetMouse() local char = player.Character local roll = Instance.new("Animation") roll.AnimationId = "rbxassetid://3027027786" local animloader = char.Humanoid:LoadAnimation(roll) function KeyD(key) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userid, 6014768) then key = key:lower() local hotkey = script.Hotkey if key == hotkey.Value then local animloader = char.Humanoid:LoadAnimation(roll) animloader:Play() end end end mouse.KeyDown:connect(KeyD) function Move(key) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userid, 6014768) then key = key:lower() if key == "w" or key == "a" or key == "s" or key == "d" then animloader:Stop() end end end mouse.KeyDown:connect(Move)
roblox updated userId to UserId, change that
the keyDown part needs to change to this
local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() mouse.KeyDown:Connect(function(key) local Key = key.lower("key in here") if key == ("same key in here") then function here end end)
userid
needs to be properly formatted to UserId
or it will error. Replace both instances of it in your script the error will stop. The updated script should look like this:
``` repeat wait(.1) until game.Players.LocalPlayer.Character ~= nil repeat wait(.1) until game.Players.LocalPlayer.Character.Humanoid ~= nil player = game.Players.LocalPlayer mouse = player:GetMouse()
local char = player.Character local roll = Instance.new("Animation") roll.AnimationId = "rbxassetid://3027027786" local animloader = char.Humanoid:LoadAnimation(roll) function KeyD(key) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 6014768) then key = key:lower() local hotkey = script.Hotkey
if key == hotkey.Value then local animloader = char.Humanoid:LoadAnimation(roll) animloader:Play() end end
end
mouse.KeyDown:connect(KeyD)
function Move(key) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 6014768) then key = key:lower() if key == "w" or key == "a" or key == "s" or key == "d" then animloader:Stop() end end end
mouse.KeyDown:connect(Move) ```
On a side note, KeyDown is deprecated due to its inability to detect multiple key presses at a time. A post on the developer wiki can be found here explaining how to integrate new and better key input methods into your game.