It sends a error that says Character is not a valid member of Player? Code:
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Audio = Instance.new("Sound")
Sound.Parent = player.Character
Sound.SoundId = "9858343944"
Mouse.KeyDown:Connect(function(Key)
if Key == "W" then
Mouse.KeyDown:Connect(playsound)
Sound:Play()
Mouse.KeyUp:Connect(stopsound)
Sound:Stop()
end
end)
Hello,
if you are accessing the player from workspace than you don't need player.Character
you can just parent the Audio to the Player directly.
if it still doesn't work, what you can do is
local Plr = game.Players.LocalPlayer local Mouse = Plr:GetMouse() local Audio = Instance.new("Sound") Audio.Parent = Plr Audio.SoundId = "9858343944" Mouse.KeyDown:Connect(function(Key) if Key == "W" then Sound:Play() playsound() end end) Mouse.KeyUp:Connect(function(Key) if Key == "W" then Sound:Stop() stopsound() end end)