Try this to detect inputs. It works perfectly for computers, but I also checked for movement so that it can deal with mobile as best as I can think of, since Enum.UserInputType.Keyboard doesn’t detect any keyboard use on mobile devices. (Read PS below for more important info)
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local EmoteStopped = true
local function stopEmote()
game.ReplicatedStorage.ChatEDANCEstop:FireServer(senderp)
end
game.ReplicatedStorage.ChatEDANCE:FireServer(senderp)
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
stopEmote()
end
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if Humanoid.MoveDirection.Magnitude > 0 then
if EmoteStopped == false then
EmoteStopped = true
stopEmote()
end
elseif Humanoid.MoveDirection.Magnitude == 0 then
if EmoteStopped == true then
EmoteStopped = false
end
end
end)
Humanoid.StateChanged:Connect(function()
if Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
if EmoteStopped == false then
EmoteStopped = true
stopEmote()
end
else
if EmoteStopped == true then
EmoteStopped = false
end
end
end)
end)
PS: I only tested mobile devices in Roblox Studio in the “TEST” tab, so I’m not exactly sure if they can detect any inputs from a keyboard, since Roblox studio used a keyboard that didn’t actually type anything when keys were pressed.