I made a script to detect if a player is on mobile, if they are i will destroy the script.
This is my code
local ismobile = game:GetService('UserInputService').TouchEnabled
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
if ismobile == true then
script.Parent.punch:Destroy()
end
mouse.Button1Down:Connect(function()
local playermodel = game.Workspace:FindFirstChild(player.Name)
playermodel.punchevent:FireServer()
end)
If the if statement does print and what @NotFrindow suggested still doesn’t work, you could try :Disconnect()ing the .ButtonOneDown event.
local ismobile = game:GetService('UserInputService').TouchEnabled
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local con
if ismobile == true then
script:Destroy()
con:Disconnect()
end
con = mouse.Button1Down:Connect(function()
local playermodel = game.Workspace:FindFirstChild(player.Name)
playermodel.punchevent:FireServer()
end)
Sorry if it isn’t formatted correctly, it’s tough typing on a phone.