`Enum.UserInputType.Touch` not being detected

In my game, I have spells that you type in the chat. It works fine for PC/Laptop players, but the chat isn’t being detected for players on mobile.

I am using the legacy chat system, NOT the new one.

my script:

local spell = false
local sendNotif = false

player.Chatted:Connect(function(msg)
	if string.lower(msg) == "ignis" then 
		spell = true
		sendNotif = true
		loadedSpell.Value = "Ignis"
	end
end)

the issue is with the loadedSpell.Value = "Ignis" line. The loaded spell value does not change when a mobile user says the spell, but it does for PC players.

2 Likes

Have you checked what msg is? The event should fire as I don’t really see anything specific about mobile in the documentation.


i added a print(msg) to the script after the loadedSpell.Value line and it prints when on pc and when on mobile, and the loadedSpell.Value changes now, but the spell won’t actually cast.

1 Like

after the chat function, i have a UserInputService detection that detects MouseButton1Click or Touch input, and it works fine for the pc, but again an issue with mobile. It will not cast at all on mobile.

script:



UIS.InputBegan:Connect(function(Key, gameProcessed)
	if gameProcessed then return end
	if Key.UserInputType == Enum.UserInputType.MouseButton1 and spell == true and player.Character.Ragdoll.Value == false and not player.Character.Humanoid.PlatformStand and player.Character.Humanoid.Health > 0 and player:FindFirstChild("Concilium") or Key == Enum.UserInputType.Touch and spell == true and player.Character.Ragdoll.Value == false and not player.Character.Humanoid.PlatformStand and player.Character.Humanoid.Health > 0 and player:FindFirstChild("Concilium") then
		PlrNotificationHandler.NewWarning("Invisibilis is on cooldown for "..Cooldown.." seconds.", 5.5)
		loadedSpell.Value = "None"
		print("sent cooldown notif")
		sendNotif = false
		spell = false
		loadedSpell.Value = "None"
	end
end)

im not sure if the way i’m doing it for mobile is the issue or if its just something else causing it, but

on pc: the loadedSpell.Value gets set to “None”

on mobile: the loadedSpell.Value stays as the spell and does not change

If I remember correctly, Enum.UserInputType.MouseButton1 will only run for users with a mouse if using UserInput service. Try adding Enum.UserInputType.Touch to your if statement and tell me if that fixes your result.

it’s already there

it doesn’t work

bump

still no improvements

characterssssssss

The issue is that you are checking if Key == Enum.UserInputType.Touch, you should check if Key.UserInputType == Enum.UserInputType.Touch

1 Like

Thank you so much!
characterssss

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.