Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Search through a set help?

Asked by
Vividex 162
9 years ago

How would I go about making a script that goes through one of your sets, finds decals, gets the decals ID's and puts them in a table, and randomly chooses those decals and puts them on a part?

1 answer

Log in to vote
1
Answered by 9 years ago

I don't quite know how to get them from a set, but there is an alternative. First, you put all the decals in a model. To do that, put the decal on the part how you want it to look, then cut and paste it into the model . You then what to name each one of them a different number. For example, if you have 3 decals, name them 1, 2, and 3. Then you put this script in the model with the decals:

Part = Workspace.Part --Change this to the part you want the decal on
Model = script.Parent
HowMany = 10 --Change this to however many decals you have
while true do --Remove this if you don't want to loop
    Number = math.random(1, HowMany) --Chooses a decal
    Decal = Model:FindFirstChild(Number)
    Decal.Parent = Part
    --Remove the rest if you don't want to loop
    wait(5) --How often you want the decal to change
    Decal2 = Part:FindFirstChild("Decal") --Finds the decal again
    Decal2.Parent = Model
    Number = nil --Resets the number
end

I have tested this, and it should work!

Ad

Answer this question