Hi Is there anybody out there that can help me fix this script?
local UserInputService = game:GetService("UserInputService")
local lastInput = UserInputService:GetLastInputType()
if (lastInput == Enum.UserInputType.Keyboard) then
script.Parent.Device.Image = "rbxassetid://6980134429"
elseif (lastInput == Enum.UserInputType.Touch) then
script.Parent.Device.Image = "rbxassetid://6980136045"
elseif (lastInput == Enum.UserInputType.Gamepad1) then
script.Parent.Device.Image = "rbxassetid://6980135159"
end
The script somewhat works but only for PC/Keyboard i have also tried changing keyboard to mouse but still ended up with the same results.
local UserInputService = game:GetService("UserInputService")
local lastInput = UserInputService:GetLastInputType()
print("test",lastInput)
if (lastInput == Enum.UserInputType.Keyboard) then
print("PC")
elseif (lastInput == Enum.UserInputType.Touch) then
print("Mobile")
elseif (lastInput == Enum.UserInputType.Gamepad1) then
print("Xbox")
end
although the first if statement didn’t work because LastInput was always Enum.UserInputType.MouseMovement for me on PC when I tested on mobile