im trying to have my script play an animation and set a bool value to true while the key is pressed. i dont get any errors in the output but at the same time nothing is printing in the output
local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid") --gets the humanoid
local anim1 = hum:LoadAnimation(script:WaitForChild("BlockAnim"))
anim1:Play()
game:GetService("UserInputService").InputBegan:connect(function(input) -- Input Began checks if the player presses anything and fires whenever the player does so.
if input.KeyCode == Enum.KeyCode.F then -- This detects for a "e" press.
print("1")
char.Blocking.Value = true
anim1:Play()
end
end)
game:GetService("UserInputService").InputEnded:connect(function(input) -- Fires when input ended
print("2")
char.Blocking.Value = false
anim1:Stop()
end)
local Player = game.Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local hum = char:FindFistChild(“Humanoid") --gets the humanoid
local anim1 = hum:LoadAnimation(script:WaitForChild(“BlockAnim”))
anim1:Play()
game:GetService(“UserInputService”).InputBegan:connect(function(input, IsTyping) – Input Began checks if the player presses anything and fires whenever the player does so.
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.F then -- This detects for a "e" press.
print("1")
char.Blocking.Value = true
anim1:Play()
end
end)
game:GetService(“UserInputService”).InputEnded:connect(function(input, IsTyping) – Fires when input ended
if IsTyping then return end
print(“2”)
char.Blocking.Value = false
anim1:Stop()
end)