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

Can someone help me with gui gamepad instructions?

Asked by 8 years ago

EDIT: I am trying to make a small Y button pop up to tell you to press Y to open the store. The indicator pops up and then goes back until you click Y. I don't understand why my code isn't working since I get no errors and I don't see anything in the code.

local InputImageLibrary = require(408470686)

game:GetService("Players").PlayerAdded:connect(function(player)
    wait(1)
    local playerGui = player:WaitForChild("PlayerGui")
    local frame = playerGui.Shop.Frame

    if game:GetService("UserInputService").GamepadEnabled then
        local Y = InputImageLibrary:GetImageLabel(Enum.KeyCode.ButtonY, "Dark")
        Y.Name = "yIndicator"
        Y.Parent = frame
        Y.Size = UDim2.new(0.19,0,0.1,0)
        Y.Position = UDim2.new(.81,0,0,0)

        while true do
            Y:TweenPosition(UDim2.new(1,10,0,0), "Out", "Elastic", 2, true)
            wait(10)
            Y:TweenPosition(UDim2.new(.81,0,0,0), "In", "Quad", .3, true)
            wait(3)
        end
    end
end)


This script is in the ServerScriptStorage.

Thank you in advance for any help.

0
For anyone who was wondering, I solved the issues with the functions not working by reorganizing and cleaning up my previous code. It was a structural mess but now it's neat and easier to read. FierceByte 25 — 8y
0
Your supposed to be using local scripts and putting them in the player to access and change guis. If you really want to use a server script then use a remoteevent to communicate with the local script and run it there. LifeInDevelopment 364 — 8y
0
@ThePhantomDeveloper The issue is I can't use require in a local script. It errors. I think this will work, thank you! FierceByte 25 — 8y

Answer this question