im trying to make a for loop where one of the values is the text from a texbutton gui problem is, it says forloops can only take number values is there any way to fix this? i type numbers into the text button, but it still does not work

code:


wait(1)
local player = script.Parent.Parent.Parent.Parent
local Mouse = player:GetMouse()
script.Parent.Parent.Parent.Start.StartButton.MouseButton1Click:connect(function(click)
	wait(1)
	for i = script.Parent.Parent.Parent.Objects.Object.Position,script.Parent.Text,.1 do
		script.Parent.Parent.Parent.Objects.Object.Position = script.Parent.Parent.Parent.Objects.Object.Position + UDim2.new(0,0,0,i)
		wait(.5)
	end
	end)

10 comments

0

You can use numbers. If it's not letting you, you're doing something wrong.

0

you wanna bet?

0

Players.wookey12.PlayerGui.ScreenGui.TextBox.Script:6: 'for' initial value must be a num

0

That's a code error you have there. If it's troubling you, post a new question regarding it.

0

i added the code, do i have an error?

0

@TheeDeathCaster so i didn't make an error? thank you!

2

uhh it would be tonumber("script.Parent.Text") right? if it is, it didn't work. maybe it has to do with the position?

0

No. doing "script.Parent.Text" is what it is actually trying to become, not the text in the textbox.

0

@hiimgoodpack that's what the textbox is though....... the script is parented in the textbox if i say script.Parent.Text, it means the text in textbox...