Why isn't my script working?

What @ComplicatedParadigm said, wouldn’t it be easier to just put the ID’s into a table?

2 Likes

Try adding s to the http? I remember the same problem occured to another person, but with animations.

1 Like

I don’t think it’d make any difference, as long as it’s a ROBLOX Url then it should be fine:

Perhaps try this:

local Thing = script.Parent
local Decals = {
    "http://www.roblox.com/asset/?id=6881965865";
    "http://www.roblox.com/asset/?id=6897736901";
}

while true do
    Thing.Decal1.Texture = Decals[1]
    Thing.Decal2.Texture = Decals[1]
    print("Changing to 1")
    wait(30)
    Thing.Decal1.Texture = Decals[2]
    Thing.Decal2.Texture = Decals[2]
    print("Changing to 2")
    wait(30)
end

Wouldn’t hurt to print

2 Likes

Make sure the link actually redirects you to the asset not a 404 page

1 Like

Add a wait after the second texture line. I think that will go through the second one too quickly and just go back to the first one.

1 Like

Are you trying to get an image from the library?

Are you sure that the problem isn’t that the texture are badly positioned on the object? Also try use “rbxassetid://ID” instead of the http link.

According with @ComplicatedParadigm you could use this script:

local id = {1234, 12345}

while true do
    script.Parent.Texture = "rbxassetid://"..id[math.random(1, #id)]
    wait(30)
end
1 Like

Change the wait time smaller, then see if it works. If not working then your link might not be right.

local decals = {
6881965865,
6897736901
}

while (wait(30)) do
    local decal = "rbxassetid://" .. decals[math.random(1, #decals)]

    script.Parent.Decal1.Texture = decal
    script.Parent.Decal2.Texture = decal
end

That should work but I don’t think the string is necessary since it works with the ID too.

You need the string because by a script it doesn’t set the string automatically as it does when is set by a user.

No, I am pretty sure it does not work with the ID by itself.

you don’t need the brackets for the wait function

while wait(30) do block end
1 Like

It’s a personal preference :face_with_raised_eyebrow:

1 Like

It works and changes the property like this:
image

But in the game it appears like this:

Are the Decals fully loading in? There could be the possible chance that it hasn’t loaded or not, and do check the Output for errors?

There are no errors, as it seems the decal’s texture property is being filled but it doesn’t enter.

Try this:

function format(Id)
	return string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", Id)
end

while wait(30) do
	script.Parent.Decal1.Texture = format(6881965865)
	script.Parent.Decal2.Texture = format(6881965865)
	wait(30)
	script.Parent.Decal1.Texture = format(6897736901)
	script.Parent.Decal2.Texture = format(6897736901)
	wait(30)
	script.Parent.Decal1.Texture = format(6881965865)
	script.Parent.Decal2.Texture = format(6881965865)
	wait(30)
	script.Parent.Decal1.Texture = format(6897736901)
	script.Parent.Decal2.Texture = format(6897736901)
end

Something wrong?
Original post:

1 Like

That works! Thanks a lot!

whydoihavetodothirtycharacters

1 Like

Try to use this:

rbxassetid://0 – Change 0 to your image id

1 Like