local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
print("child found its", humanoid.Parent.Name)
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.E then
print("e pressed")
humanoid.WalkSpeed = 50
wait(1.7)
humanoid.WalkSpeed = 20
end
end)
end
end)
end)```
im a beginner to coding and im trynna make some ability where u js go super fast for a lil bit, only thing is there are no errors but it js wont make me go fast OR print that the e key was pressed
#might be a quick problem
1 messages · Page 1 of 1 (latest)
UserInput is a client side service
put it in a local script under starter player scripts
local UserInputService = game:GetService("UserInputService")
local players = game:GetService("Players")
local flashStep = false
local cooldown = false
local player = players.LocalPlayer -- defines the player
local character = player.Character or player.CharacterAdded:Wait() --looks for the character in the player
local humanoid = character:FindFirstChild("Humanoid") --looks for the humanoid in the character
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.E and cooldown == false then
print("flash step on")
flashStep = true
cooldown = true
humanoid.WalkSpeed = 50
wait(1.6)
print("flash step off")
humanoid.WalkSpeed = 20
flashStep = false
print("cooldown on")
cooldown = true
wait(2)
print("cooldown off")
cooldown = false
end
end)
figured it out