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

Numbers not registering?

So this script basically grabs the Text values (which start out blank) and teleports the brick to those XYZ coordinates. However, whenever I enter a value In-Game it doesn't register it and the brick goes to 0, 0, 0. How would I fix this?

local EnterButton = script.Parent.EnterButton
local XBox = script.Parent.XBox.Text
local YBox = script.Parent.YBox.Text
local ZBox = script.Parent.ZBox.Text

EnterButton.MouseButton1Down:connect(function()
game.Workspace.Part11.CFrame = CFrame.new(XBox, YBox, ZBox)
end)

2 comments

1

Please dont ask the same question twice. Did you even try the answer I gave you?

0

You didn't give me an answer @BSincorperated

1 answer

You need to use the tonumber method!

Since the Text property of a gui holds a string, and a CFrame takes numbers you have to convert the strings to numbers using tonumber.

local EnterButton = script.Parent.EnterButton
local XBox = tonumber(script.Parent.XBox.Text)
local YBox = tonumber(script.Parent.YBox.Text)
local ZBox = tonumber(script.Parent.ZBox.Text)

EnterButton.MouseButton1Down:connect(function()
	workspace.Part11.CFrame = CFrame.new(XBox, YBox, ZBox)
end)

1 comment

0

It's not working for some reason.

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