I’m trying to make a billboard image that’s attached to an enemy’s torso play a walk animation by changing the image in a script. For some reason the image is completely invisible when the script runs, and there are no errors. It doesn’t seem like a problem with the images because they work fine when manually inserted to the billboard image.
Animate script:
local imageLabel = script.Parent.Torso.BillboardGui.ImageLabel
local Idle = script.Parent.Idle
local Walk1 = script.Parent.Walk1
local Walk2 = script.Parent.Walk2
while true do
imageLabel.Image = Walk1.Value
print("walk 1, " ..imageLabel.Image)
wait(.2)
imageLabel.Image = Walk2.Value
print("walk 2, " ..imageLabel.Image)
wait(.2)
end
Maybe try to preload the images using ContentProvider?
You would basically have a LocalScript in ReplicatedFirst and it would contain this:
task.spawn(function()
local assets = {image1,image2} -- put your images here
local ContentProvider = game:GetService("ContentProvider")
ContentProvider:PreloadAsync(assets)
end)
I tried this and it has no affect. The images are not deleted, and they work when manually inserted into the image label but not if I insert them via the script.
local imageLabel = script.Parent.Torso.BillboardGui.ImageLabel
local Idle = script.Parent.Idle
local Walk1 = script.Parent.Walk1
local Walk2 = script.Parent.Walk2
while true do
task.wait(1)
imagelabel.Image = "rbxassetid://"..tonumber(Walk1.Value)
task.wait(1)
imageLabel.Image = "rbxassetid://"..tonumber(Walk2.Value)
end
I would rather not settle for a compromise unless completely necessary. I’ve seen this same method I’m using work for others so there must be something I’m missing.