Hello,
Can i somehow select randomly decals with the same name?
I am trying to make a realistic color. And i have too many of them.
Also i don’t know if this is the good Topic so Sorry if im wrong.
Thank you.
Hello,
Can i somehow select randomly decals with the same name?
I am trying to make a realistic color. And i have too many of them.
Also i don’t know if this is the good Topic so Sorry if im wrong.
Thank you.
Hmm. I’m not sure that I understood you correctly but let me try.
Yes, you can select decals randomly in Roblox Studio. Here’s one approach you can follow:
local decalName = "NameOfYourDecal" -- Replace "NameOfYourDecal" with the actual name of your decal
local decals = game.Workspace:GetDescendants()
local matchingDecals = {}
for _, decal in ipairs(decals) do
if decal:IsA("Decal") and decal.Name == decalName then
table.insert(matchingDecals, decal)
end
end
if #matchingDecals > 0 then
local randomDecal = matchingDecals[math.random(1, #matchingDecals)]
randomDecal.Parent = workspace
randomDecal.Transparency = 0 -- To make the decal visible
end
Replace "NameOfYourDecal" with the actual name of your decal. Make sure the name matches exactly (including capitalization).
Save the script and run it in Roblox Studio. This script will search for all decals in the workspace that have the specified name and store them in the matchingDecals table. Then, it will randomly select one decal from that table and make it visible by setting its transparency to 0.
Note: Make sure you have the necessary permissions to modify decals in Roblox Studio. Additionally, this script assumes that you want to select decals in the workspace but you can modify it to select decals from a different location if needed.
I’m sorry if this scripr didn’t work. I tried my best.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.