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

Why doesn't this frame become visible when player is on xbox?

Asked by 6 years ago

Here's my code.

if game:GetService("UserInputService").GamepadEnabled then
    game.StarterGui.MainGui.XboxFrame.Visible = true
end

1 answer

Log in to vote
0
Answered by 6 years ago

You do not get the frame from StarterGui. You get it from PlayerGui.

if game:GetService("UserInputService").GamepadEnabled then

    local pgui = game:GetService("Players").LocalPlayer.PlayerGui
    pgui.MainGui.XboxFrame.Visible = true
end
0
use game.Players just easier no diffrent i don't think than what you did mattchew1010 396 — 6y
0
No, game.Players is prone to script failure, should the Players service be renamed.. User#19524 175 — 6y
Ad

Answer this question