I am trying to make a code run only when the frame is visible. Here is my code:
local key = http:GetAsync("mylink", true)
while script.Parent.Parent.Visible do
wait()
script.Parent.Text = key
end
when the script becomes visible, the code does not run and I have tested it to make sure it actually works so there must be an issue with the while true, any suggestions on how to fix this?
Note: I am making the frame visible through another script
local key = http:GetAsync("mylink", true)
script.Parent.Parent.Changed:Connect(function()
while script.Parent.Parent.Visible do
wait()
script.Parent.Text = key
end
end)
I have another script that is controlling my events, when a player enters a valid input, it checks it and if the input is valid, it makes the frame visible. This is when I want the loop to start running.
This is the code that is making the frame visible (note this bit is inside a separate local script)
Here is the explorer, the control is what is making the frame visible and the script is what I am trying to make display the correct key when the frame is visible
game.ReplicatedStorage.UpdateFT.OnClientEvent:Connect(function(subcheckTrueFalse)
if subcheckTrueFalse then
while script.Parent.Parent.Visible and task.wait() do
script.Parent.Text = key
end
end
end
could I use an string value instead using a script to define the text, and then change the serverscript in the UI to a local script with a loop showing the string?
if you try to hide the values, local scripts can no longer access it
you can use remote events to send keys but firing remote events every few seconds would increase ping a lot