So i’ve been trying to make a script that changes an image label, transparency, to be exact. But as I realized, it cant do it because the statement of the ImageLabel IsLoaded is set to false when I test the experience, but when I check it after testing - it’s set to true. What is going on?
Perhaps showing us your code would help lol
local TweenService = game:GetService("TweenService")
local ContentProvider = game:GetService("ContentProvider")
local textLabel = script.Parent
local textSound = script.Parent.Sound
local textLabel2 = script.Parent.Parent:FindFirstChild("TextLabel2")
local frame = textLabel.Parent
local afterImage = frame.AfterImage
local function createTween(instance, property, endValue, duration)
local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local tween = TweenService:Create(instance, tweenInfo, {[property] = endValue})
return tween
end
local function changeTransparency()
local textTween1 = createTween(textLabel, "TextTransparency", 1, 2.5)
local textTween2 = createTween(textLabel, "TextTransparency", 0, 2.5)
local textTween3 = createTween(textLabel, "TextTransparency", 1, 2.5)
local textTween4 = createTween(textLabel2, "TextTransparency", 1, 2.5)
local textTween5 = createTween(textLabel2, "TextTransparency", 0, 2.5)
local textTween6 = createTween(textLabel2, "TextTransparency", 1, 2.5)
textTween1:Play()
textTween1.Completed:Wait()
textSound:Play()
textTween2:Play()
textTween2.Completed:Wait()
textTween3:Play()
textTween3.Completed:Wait()
local frameTween = createTween(frame, "BackgroundTransparency", 1, 4)
frameTween:Play()
textTween4.Completed:Wait()
textTween5:Play()
textTween5.Completed:Wait()
textTween6:Play()
textTween6.Completed:Wait()
frameTween.Completed:Wait()
task.wait(3)
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local tween = createTween(afterImage, "ImageTransparency", 1, 2.5)
tween:Play()
tween.Completed:Wait()
end
changeTransparency()
What are you expecting to happen?
for the image to change it’s transparency to 1?
And what is it doing right now when you test it? Also, you have an unused tweenInfo above the tween where you change the ImageTransparency.
When I test it, it basically does NOTHING with the image at all! However, the text does change. In the properties the image states that it’s IsLoaded is set to false.
Did you make sure that the image link is working? Make sure it’s working in studio when you’re not testing and when play testing. Try play testing and setting the image link manually as well. Mess with the other properties while play testing also. It if it works when you set the properties manually in play test, then it has to be some error in your code.
The problem is that I cannot change the IsLoaded property while play testing, and yeah the image link is correct.
Did you try add a wait in the beginning?
i don’t think I could help unless I could go in studio and see what’s actually happening. Are you getting any errors? Have you tried print statements. If you want, you can send a copy of the place so I can help debug
isLoaded, which is a read only property meaning you can’t change it, says whether the client has loaded the image or not, if the script is a local script you can use game:GetService(“ContentProvider”):PreloadAsync(AssetIdHere) to make the client load the image
Still, even after doing that images are not loading at all. It still says that IsLoaded is un-checked
have u tried making sure the Visible property is checked?
The problem here is not of the visibility of images, it’s just the property that is unchecked that makes me unable to change the transparency of each image
That means that the image is invalid, if the IsLoaded property is unchecked roblox failed to load it on it’s own.
Did you try restarting your studio and checking if the problem remains? Also is this problem appearing when playing the game or only in-studio
ONLY when i test it, and yes i’ve been trying to close and open the studio - the problem remains…
Try using a different image link to make sure it’s actually not the image.
I’ve made sure that its not a problem in the image and thats for sure
Keep in mind IsLoaded is LocalScript only. This should catch it no matter what happens.
local imageLabel = script.Parent --wherever this is
if imageLabel.IsLoaded then
imageLabel.Transparency = 1
else
imageLabel:GetPropertyChangedSignal("IsLoaded"):Wait()
imageLabel.Transparency = 1
end
or
local imageLabel = script.Parent --wherever this is
imageLabel.IsLoaded or imageLabel:GetPropertyChangedSignal("IsLoaded"):Wait()
imageLabel.Transparency = 1
IsLoaded tests if it’s there. This script tests if it’s there and if not waits for it to be there.