The below script serves to change the length of a rope constraint based on the number inputted into a gui that appears when equipping the tool. However, the rope length only changes to the default input (so it does change), but not to what the player inputs. It seems like it is only triggering once, as I have tried placing print() in the loop to see if it triggers multiple times but nothing came up. However, all tests ran with this script have been in team test due to Adonis Admin not working in the client test (you need to use :give to get the tool). Maybe there is something I am not seeing? Does anyone know how to fix this?
Also it might be important to note that this is a server script because the rope changes need to be server side.
repeat wait() until script.Parent.Parent.Name ~= "Backpack"
local char = script.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(char)
while true do
if tonumber(player.PlayerGui.BaitLengthGui.Frame.TextBox.Text) then
script.Parent.Money.RopeConstraint.Length = tonumber(player.PlayerGui.BaitLengthGui.Frame.TextBox.Text)
wait()
end
end

4 comments
I don't see how this is supposed to work
Read the context
for does something multiple times. change the 5 to how many times you want it to run. it also passes a variable, in this case "i" and i is set equal to the loop count.
But the issue isn't the number of times the script is running, it just won't run more than once due to some reason outside of looping it.