I have a script that is supposed to fire an event when you click or tap a player. It works perfectly fine on PC, but on mobile, it’s not working at all.
Here’s my script:
local players = game.Players
local plr = players.LocalPlayer
local char = plr.Character
local UIS = game:GetService("UserInputService")
local EffectsEvent = game.ReplicatedStorage.RemoteEvents.SFX
local DB = false
local Mouse = plr:GetMouse()
local debounce = false
game.ReplicatedStorage.RemoteEvents.ClientEvents.Incendia.OnClientEvent:Connect(function()
local connect
connect = UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton1 or key.UserInputType == Enum.UserInputType.Touch then
print("clicked")
if debounce == true then
game.StarterGui:SetCore("SendNotification", {
Title = "Notification";
Text = "This spell is on cooldown."
})
connect:Disconnect()
else
if key.UserInputType == Enum.UserInputType.MouseButton1 then
print("clicked")
if debounce == false then
if Mouse.Target.Parent:FindFirstChild("Humanoid") then
if (Mouse.Target.Parent.HumanoidRootPart.Position - char.HumanoidRootPart.Position).Magnitude < 50 then
if char.Humanoid.CanUseMagic.Value == true then
debounce = true
connect:Disconnect()
game.ReplicatedStorage.RemoteEvents.Abilities:FireServer("Incendia",Mouse.Target)
wait(20)
debounce = false
end
end
end
end
end
end
end
end)
end)