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

Why does this script not make the frame visible depending on the local players platform?

Asked by 5 years ago

Here's the script, in a localscript in StarterGui

local player = game.Players.LocalPlayer --Variable for the player
local Pc = game.ReplicatedStorage.MainGui.Pc --Variable for the gui
local Xbox = game.ReplicatedStorage.MainGui.Xbox

if game:GetService("UserInputService").GamepadEnabled then
        Xbox:Clone().Parent = player.PlayerGui
            Xbox.Visible = true

if game:GetService("UserInputService").KeyboardEnabled then         
        Pc:Clone().Parent = player.PlayerGui
            Pc.Visible = true 
            end
        end
    end
end

Please let me know what I've done incorrectly. Thank you.

1 answer

Log in to vote
0
Answered by 5 years ago

You have to parent the screen gui to player gui, not just frame.

Simple fix would be to just put those frames in one screen gui, then clone a screen gui and parent it to player gui, and then access one of those frames and set it's visible property to true.

0
Could you possibly edit my code to what it should be please? eizaray1234 -12 — 5y
Ad

Answer this question