So Here is what I have so far
local UIS = game:GetService("UserInputService") local GuiService = game:GetService("GuiService") if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then else game.Players.LocalPlayer.PlayerGui.TopGuis.Group.Size.Value = UDim2.new({0.293, 0},{0.122, 0}) end
I tested it out on many devices it didn't change a thing. I tested in to local scripts and normal and still nothing. In the output if I put in a regular script it shows an error message on the line about game.Players.LocalPlayers......... and says like attempt to index player gui a nil value. On a local script nothing shows up in the output. Help would be appreciated. My goal here is to change something if detected on a computer. I made the loop to detect for a mobile device and put an else to show when it returns it would be a computer which was my goal to change it. i will change the action it will do but any help will be greatly appreciated.
EDIT: so here is what I have now
local UserInputService = game:GetService("UserInputService") local label = script.Parent --change to the text label local frame = script.Parent.Parent local messages = { TouchEnabled = "Tap!", KeyboardEnabled = "E", GamepadEnabled = "B" --or whatever it is } for key, value in pairs(messages) do if(UserInputService[key]) then label.Text = value break end end local sizing = { TouchEnabled = UDim2.new(0, 0,0, 0) }; for key, value in pairs(sizing) do if(UserInputService[key]) then frame.Size= value break end end
I was originally editing the text for a button but needed to adjust the size of a whole frame as well so the parent.Parent is the frame
well just put a local script in the GUI that you want text changed, and write the following;
local UserInputService = game:GetService("UserInputService") local label = script.Parent --change to the text label local messages = { TouchEnabled = "Tap", KeyboardEnabled = "E", GamepadEnabled = "B" --or whatever it is } for key, value in pairs(messages) do if(UserInputService[key]) then label.Text = value break end end
also,all you need to do to make things resize and position proportionally on all devices is, make sure the their Size
and Position
properties are set in Scale
and not Offset
..
EDIT: you can make specific adjustments to sizing on different devices like this:
local sizing = { TouchEnabled = UDim2.new(S, O, S,O) }; for key, value in pairs(sizing) do if(UserInputService[key]) then label.Size= value break end end
remember, UDim2
takes 4 numbers, not 2 arrays