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

Why cant I add a surface gui to this part?

Asked by 3 years ago

I'm just trying a simple TickTacToe thing, so I've decided to use surfaceGui's to visually mark the X's and O's. Problem is, no matter what I do in this code, it for whatever reason does not seem to affect the game.

local CreateGUI = function(XorO)
    local SurfaceGUI = Instance.new("SurfaceGui",script.Parent)
    local TextLabel = Instance.new("TextLabel", SurfaceGUI)
    --TextLabel.BackgroundColor3 = Color3.new(163, 162, 165)
    TextLabel.BackgroundTransparency = 1
    TextLabel.Size = UDim2.new({0, 200},{0, 200})
    TextLabel.RichText = true
    TextLabel.TextScaled = true 
    TextLabel.Text = "XorO"
end

ClickDetector.MouseClick:Connect(function(plr)
    local WhoOwns = Instance.new("BoolValue",script.Parent)
    WhoOwns.Name = "WhoOwns"
    if Turn.Value == true then
        --Place X
        print(X)
        WhoOwns.Value = true
        Turn.Value = false 
        CreateGUI("X")
    else
        --Place 0 
        print(O)
        WhoOwns.Value = false
        Turn.Value = true 
        CreateGUI("O")
    end

    ClickDetector:Destroy()
end)

(all in a server script)

For whatever reason, although the surfaceGui shows up in the explorer, it does not visually show up at all in the game.

1
Did you make sure you were adding it to the correct face? OrchidDumpling 16 — 3y
0
Yup, im sure generalYURASKO 144 — 3y
0
Oh, just checked, thats the problem, thanks. generalYURASKO 144 — 3y

Answer this question