So, I am trying to make a textbox if where you put 0.9, it will put the car's height like a lowrider. But it is not changing and gives me this error: 18:05:06.931 - Players.squidiskool.PlayerGui.ScreenGui.TextBox.Script:1: attempt to call field 'Text' (a string value)
Here is the code if you want to look further:
if script.Parent.Text ("0.9") then game.Workspace.body.Position ("5.167") end
I am a beginner in coding, so I am not perfect.
Hey, so this should work.
local Box = script.Parent Box.FocusLost:Connect(function(enterPressed) if enterPressed then print("Input recieved") end local Number = ("0.9") if Box.Text == (Number) then print("Input is equal to number") --Add your stuff here end end)
Make a local script with these lines & put it inside a textbox. It will compare the input to the number you specify and perform an action if correct.
I did change the code a bit, but it still outputs the error.
if script.Parent.Text ("0.9") then game.Workspace.body.Position ("-5.408, 4.167, 21.135") end
First, use == for comparing two values if they equal.
Second, .Positions arent just one value. Imagine it's a value containing 3 other values.
This value for .Position is Vector3. Vector3 contains X, Y, and Z. To set the .Position, feed it a Vector3 value.
workspace.body.Position = Vector3.new(X, Y, Z)
X would be numbers of X coordinate, Y would be numbers of Y coordinate, and Z would be numbers of Z coordinate.
Hi, I'm not sure where you learned how to compare values like that, but here is your code but functional.
if script.Parent.Text == "0.9" then workspace.body.Position = Vector3.new(-5.408, 4.167, 21.135) end