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)
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)