Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Taking input from a GUI and positioning a brick?

How would one go about taking a set position that a user entered into a GUI and having it position a brick at those coordinates?

2 answers

✓ Accepted answer

Have 3 textbox for X Y Z and then by creating a script such as:

EnterButton.MouseButton1Down:connect(function()
game.Workspace.INSERTNAMEOFBRICK.Position = CFrame.new(XBox, YBox, Zbox)
end)

Also make sure to have a TextButton for the Enter. By doing this you use CFrame to change the positions using Vector3 (Or CFrame). CFrame and Vector3 include a X,Y,Z. Entering the coordinates (X,Y,Z) you change the position.

1 comment

0

Whenever I change the Text values in-game it doesn't update and the brick stays in the same spot.

Assuming you're going off of the Text property of the Gui then what you have to do is take the text, and convert it into a number using the tonumber method, and use the result as the arguments for the CFrame.

E.G.

local text = gui.Text
local num = tonumber(text)
local Cframe = CFrame.new(num)

workspace.Part.CFrame = Cframe

This discussion is preserved as it was. New answers, comments, and votes are closed.