A major issue im facing is how UserInputService doesn’t detect more than one input at a time. Here is my code that im using on the client for a sprint and slide script.
When I hold down Shift and press C or Control, nothing happens. Same can be said for when I hold C/Control and press Shift.
If there’s something really dumb that I missed please let me know. No other posts have helped me.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
UserInputService.InputBegan:Connect(function(Input,GPE)
print(Input.KeyCode)
if UserInputService:IsKeyDown(Enum.KeyCode.C) or UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
print("crouchclient")
ReplicatedStorage.Remotes.Movement:FireServer("Crouch",true)
end
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
print("runclient")
ReplicatedStorage.Remotes.Movement:FireServer("Running",true)
end
end)
UserInputService.InputEnded:Connect(function(Input,GPE)
if Input.KeyCode == Enum.KeyCode.LeftShift then
ReplicatedStorage.Remotes.Movement:FireServer("Running",false)
end
if Input.KeyCode == Enum.KeyCode.C or Input.KeyCode == Enum.KeyCode.LeftControl then
ReplicatedStorage.Remotes.Movement:FireServer("Crouch",false)
end
end)
Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if Character.Humanoid.MoveDirection.Magnitude < 0.1 then
ReplicatedStorage.Remotes.Movement:FireServer("Running",false)
end
end)