What’s up, title is self explanatory. Here’s the code:
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.CharacterAdded:Wait() or player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid.Animator
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.F then
print("Holding")
end
end)
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.F then
print("Released")
end
end)
Put a print at the top of the script to know when it runs.
Some common checks that you could do, is hit play in studio, and see if you can locate the script that should be running. Verify that it is the type of script you expect and that it will run in the context that it is in. Verify that it is not disabled.
In your case, you’ll probably expect to see it in Players.[player].PlayerScripts as a LocalScript
I put a print at the top, however it seems the script isn’t running at all, as it isn’t printing. Also, the script is still enabled, and for some reason isn’t working which is pretty strange. I have the script in StarterPack, as it’s going to be a combat script, and scripts I normally place in StarterPack do work, it’s just this one in particular for some reason. I even tried opening the script in another studio and the code won’t run.
Even so, it still doesn’t work. I just tried placing a print statement above defining the player and its components, and that works, so it seems that everything after I define the player just breaks the script?