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

Why will this text not change and why will the GUI not disappear?

Asked by 4 years ago
Edited 4 years ago
local cordRem = game.ReplicatedStorage.coordinates
local userInput = game:GetService("UserInputService")

cordRem.OnServerEvent:Connect(function(plr)
    local surface = Instance.new("ScreenGui")
    surface.Parent = plr.PlayerGui

    local textBox = Instance.new("TextBox")
    textBox.Parent = surface
    textBox.Size = UDim2.new(0.3,0,0.15,0)
    textBox.Position = UDim2.new(0.406,0,0.453,0)
    textBox.BackgroundColor3 = Color3.fromRGB(25,36,74)
    textBox.BorderColor3 = Color3.fromRGB(162,162,162)
    textBox.BorderSizePixel = 6
    textBox.Font = Enum.Font.SciFi
    textBox.TextColor3 = Color3.fromRGB(255,255,255)
    textBox.TextScaled = true
    textBox.TextSize = 56
    textBox.TextStrokeTransparency = 0
    textBox.Text = " "
    textBox.PlaceholderText = "[Enter co-ords]"


    function focusLost()
        game.Workspace.interior.cordInput.SurfaceGui.TextLabel.Text = textBox.Text
        surface:Destroy()
    end

    userInput.TextBoxFocusReleased:Connect(focusLost)    
end)

I am attempting to create a textbox for the user to type a string of coordinates into. First of all when the textbox appears it displays the text "TextBox" despite the use of:

textBox.Text = " "

Secondly when the textbox focus is released the function does not run.

It is a server script inside ServerScriptService and there are no errors in the console. I've asked a few friends and they have been unable to diagnose the issue. Does anyone have a clue?

Answer this question