I have this code that I put in a local script inside a seat. It's supposed to launch when they click left shift while sitting on it. I can't seem to figure out why it won't work. Thanks in Advance!
local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local ani = script.Parent.Animation local aT = player.Character.Humanoid:LoadAnimation(ani) uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then aT:Play() end end) uis.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then aT:Play() end end)
Local Script
local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local ani = script.Parent.Animation repeat wait() until player.Character ~= nil and workspace:FindFirstChild(player.Name) ~= nil local aT = player.Character.Humanoid:LoadAnimation(ani) uis.InputBegan:Connect(function(input, gameProcessedEvent) if input.KeyCode == Enum.KeyCode.LeftShift then aT:Play() end end) uis.InputEnded:Connect(function(input, gameProcessedEvent) if input.KeyCode == Enum.KeyCode.LeftShift then aT:Stop() end end)
Make sure to have the "gameProcessEvent" at the end, you have 2 play animations, when the InputEnded should prob be for stopping, you need to wait under the player.Character is loaded before loading the animation.