I have made a morph that allows players to jump high when E is pressed (here I just put a print script because the issue is the input) , but that script must only work on morphed player, which is why I’m trying to make it work only when the script is in a character.
The input doesn’t seem to be detected at all. Here is the script:
local char = script.Parent
local Humanoid = char:FindFirstChild("Humanoid")
local UIS = game:GetService("UserInputService")
local player = game.Players:GetPlayerFromCharacter(char) -- Getting the Player
UIS.InputBegan:Connect(function(input, GPE) -- This will detect the input, Connecting to the input that got in, GPE = Game Processed Event and is if the game processed it and if the player is busy, like typing in the chat for an example
if input.KeyCode == Enum.KeyCode.E then -- Making a if statement to ask if the players input is == to input
print("works")
end
end)
I tried putting prints on every block that defines the player that can use the input, but it seems to detect the player and character fine, with no display message. it just never detects that the player has made an input. I couldn’t find anything that solves it on the developer hub.
The problem I am having is not the player not jumping, it is the input not being detected. The “print” doesn’t work when e is pressed, even if the jumping was removed altogether. Also there isn’t an error message in console.
local char = script.Parent
print(char)
local Humanoid = char:FindFirstChild("Humanoid")
print(Humanoid)
local UIS = game:GetService("UserInputService")
print(UIS)
local player = game.Players:GetPlayerFromCharacter(char) -- Getting the Player
print(player)
UIS.InputBegan:Connect(function(input, GPE)
if GPE then return else end
if input.KeyCode == Enum.KeyCode.Backspace then
print("works")
end
end)
You’re welcome. I suggest you dig into what makes sense to use Scripts, LocalScripts and ModuleScripts, also known as server, client and replication scripts. It’s a major part in making a game, especially once the local/client scripts meet server scripts.
Starting at the Roblox API is a good first step. Then broaden from there with online tutorials and guides.