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

Textbox and Frame not showing up when visible is set to true?

Asked by 7 years ago

This script is supposed to make a textbox pop up that says player X wins, but the textbox doesn't show up. In the properties the frame and textbox are both set to visible but it's not on the screen. I tried with and without the frame.

function winx()
    game.StarterGui.win.Frame.Visible = true
    game.StarterGui.win.Frame.TextBox.Visible = true
    game.StarterGui.win.Frame.TextBox.Text = "X wins!"
end

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Looking at it, it looks like you are editing it from the StarterGui. If this script (hopefully localscript) is within the win ScreenGui, it is fine.

an example could be

local screen = script.Parent -- this would be "win"
local frame = screen:FindFirstChild("Frame") --hopefully one frame
function winx() --frame is upvalued into this function
    local tbox = frame:FindFirstChild("TextBox") --I suggest using TextLabel
    frame.Visible = true -- guessing you want it tot be visable when this function is 
    tbox.Visible = true
    tbox.Text = "X wins!"
end

When a player enters the game, or when a player respawns, the StarterGui is somewhat cloned into the Player's PlayerGui If you want to edit it directly from there, the StarterGui will not do this for you.

Ad

Answer this question