I have a shop that opens up a "tooltip" next to the mouse when entering on computer, here's the code.
plr = game.Players.LocalPlayer ReplicatedStorage = game:GetService("ReplicatedStorage") GameItems = ReplicatedStorage:WaitForChild("GameItems") UI = script.Parent TIP = UI.ShopTooltip function addComas(str) local x = tostring(str) return #x % 3 == 0 and str:reverse():gsub("(%d%d%d)", "%1,"):reverse():sub(2) or x:reverse():gsub("(%d%d%d)", "%1,"):reverse() end for _,Element in pairs(UI.ShopFrame.Items:GetChildren()) do if Element:IsA("TextButton") then SelTool = GameItems:WaitForChild(Element.Item.Value) WPConfig = SelTool:FindFirstChild("WeaponConfig") local function ComputerEnter() TIP.ItemName.Text = Element.Item.Value TIP.ItemCost.Text = addComas(require(WPConfig).Cost) .. " G$" TIP.ItemInfo.Text = addComas(require(WPConfig).MinDamage) .. "-" .. addComas(require(WPConfig).MaxDamage) .. " DMG / CD: " .. addComas(require(WPConfig).Cooldown) TIP.Position = UDim2.new(0,plr:GetMouse().X+1,0,plr:GetMouse().Y+30) TIP.Visible = true end local function ComputerMoved() TIP.Position = UDim2.new(0,plr:GetMouse().X+1,0,plr:GetMouse().Y+30) end local function ComputerLeave() TIP.Visible = false TIP.ItemName.Text = tostring(nil) TIP.ItemCost.Text = tostring(nil) TIP.ItemInfo.Text = tostring(nil) TIP.Position = UDim2.new(0,0,0,0) end Element.MouseEnter:connect(ComputerEnter) Element.MouseMoved:connect(ComputerMoved) Element.MouseLeave:connect(ComputerLeave) end end
My questions: What event do I use on console for entering and leaving a selection? How do I check which platform the client is running on?
try checking if player is on xbox with this code
local Xbox = (InputService.GamepadEnabled and not InputService.KeyboardEnabled); if Xbox then -- Actions end