Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with changing image if a player is on a certain device?

Asked by 6 years ago

Hello, I need some help with this LocalScript inside a BillboardGui to change the Parent's (ImageButton) Image depending on what device the player is on. There are no errors, and nothing happens.

local uis = game:GetService('UserInputService')
local mobile = uis.TouchEnabled
local console = uis.GamepadEnabled
local pc = not (mobile or console)

if mobile then
    script.Parent.Image = ("rbxassetid://995969403")
    script.Parent.MouseButton1Down:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995969938")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995969403")
    end)
else
    if console then
    script.Parent.Image = ("rbxassetid://995987760")
    script.Parent.MouseButton1Down:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995988254")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995987760")
    end)
    else
    if pc then
    script.Parent.Image = ("rbxassetid://995986660")
    script.Parent.MouseButton1Down:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995987092")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
    script.Parent.Image = ("rbxassetid://995986660")
    end)
        end
end
0
Read my bio. hiimgoodpack 2009 — 6y
0
Your bio has nothing to do with this problem. And that comment is getting dead annoying to read on every question I see. lukeb50 631 — 6y

1 answer

Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
6 years ago
Edited 6 years ago
local uis = game:GetService('UserInputService')
local mobile = uis.TouchEnabled
local console = uis.GamepadEnabled
local pc = not (mobile or console)

if mobile then
    script.Parent.Image = ("rbxassetid://995969403")
    script.Parent.MouseButton1Down:Connect(function(Player)
        script.Parent.Image = ("rbxassetid://995969938")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
        script.Parent.Image = ("rbxassetid://995969403")
    end)
elseif console then
    script.Parent.Image = ("rbxassetid://995987760")
    script.Parent.MouseButton1Down:Connect(function(Player)
        script.Parent.Image = ("rbxassetid://995988254")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
     script.Parent.Image = ("rbxassetid://995987760")
    end)
    else
    script.Parent.Image = ("rbxassetid://995986660")
    script.Parent.MouseButton1Down:Connect(function(Player)
        script.Parent.Image = ("rbxassetid://995987092")
    end)
    script.Parent.MouseButton1Up:Connect(function(Player)
        script.Parent.Image = ("rbxassetid://995986660")
    end)
end

Your ends were wrong all over the place. Studio would have warned you there was an error with eof. I find it hard to believe that there were no errors.

0
It is still not working. TinyScripter 70 — 6y
Ad

Answer this question