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

Why doesn't billboard gui work in game?

Asked by 6 years ago
Edited 6 years ago

Note: Works fine in studio, script is enabled and disabled when picked up and dropped

I'm making a pick up on press of "e", whereby the billboard gui's image label would show if the player is near to an object, however, it seems to be very buggy. Basically, I inserted the Billboard gui into startergui which puts it into playergui when the player joins (doesn't seem to be different from using a script to put it into playergui on join). It works perfectly in studio, whereby you would be able to go close to the object where it would show the gui, however I'm unable to get it to work in game. Do note that the first time, it would work and show the gui, however when I pick it up and place it down again, the Billboard Gui will not work. This Billboard gui script is together in the same local script as the pick up script, and to prove that it should work, I can still pick it up and place it down countless times after the bug, yet somehow only the the Billboard image gui ImageTransparency line of code will not work. I suspecting that it is a problem of playergui being a parent of a billboard gui.

Again, I would like to specify that this does not show an error and the script seems to ignore the ImageTransparency and continues with the rest of the script(picking up my object). Additionally, this script is enabled and disabled countless times when picked up and dropped.(Check script)

The code is in a local script in starter pack which in-game would be player.backpack.

local Equipped = false

--Touched event from server script connects to remote event and to this (Before this, touch event enables this script)
Prompt.onClientEvent:connect(function(player)
    HasTouched = true
    --Seems to ignore this part but continues with the rest of the code
    --ShowE.Button.E.ImageTransparency = 0
end)

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)

        -- check if E is pressed
        if inputObject.KeyCode == Enum.KeyCode.E then
                --Equips object         
                if not Equipped and HasTouched then
                    --Stops showing "Press e" Image label when equipped (Doesn't work either)
                    ShowE.Button.E.ImageTransparency = 1
                    Equipped = true 
                humanoid:EquipTool(script.Parent.Parent.Backpack:FindFirstChild("Clone"))
                    HasTouched = false

                elseif Equipped then
                    Equipped = false
                    HasTouched = false
                    --Disables this local script
                    disable:FireServer()
                end
            end 
        end
    end)

--On Touchended
Prompt2.onClientEvent:connect(function()
    HasTouched = false
    ShowE.Button.E.ImageTransparency = 1
end)

The result is that it ignores the part on ImageTransparency and continues with equipping and unequipping. Anything related to imageTransparency is somehow ignored.

Any errors unrelated to ImageTransparency should be ignored as the script above was specifically tailored to fit only relevant details.

Answer this question