I want to make a AFK command for mobile but I have a AFK for PC so I want to make a AFK command for mobile like if you type :afk
you will get a AFK tag I can do that but I just want to know how to make a command only work on mobile.
We can’t help you if you don’t already have a script, otherwise it is pretty much just giving you scripts…
I have.
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message == ":afk" then
-- Do something to detect if the player is in mobile (maybe a remote event)
end
end)
end)
local UIS = game:GetService("UserInputService")
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
Message = string.lower(Message) -- Done this so it runs the command no matter how it is typed (e.g :AfK, :aFK)
if Message == ":afk" then
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled then
-- do something
end
end)
end)
Haven’t tested this but maybe it can work.
is this in local script?
just ignore for 30 you know chara
No, a server script.
charcharchar
IDK if I can use the UIS in server script
Yes, you can use UIS in a server script. It’s a service so it can be used any script.
Nope, UserInputService is not usable in server scripts.
1 Like
Ah, apologies. Haven’t used it much so I wouldn’t know.
1 Like
So I need to use Remote Event?
1 Like
Yes
Extrawordsyayafunwhypleasehelp