I’ve been trying for some hours on a script that detects the size of a ball and change the color and material, but I don’t know why it doesn’t work. Anyways here is the script
Code 1:
local folder = game.Workspace.Planets
while true do
wait(0.1)
local clonedpart = game.Workspace.Planets:WaitForChild("ClonedPlanet")
print(clonedpart.Size.X)
if clonedpart.Size.X >= 300 then
local randomcolor = math.random(1,3)
if randomcolor == 3 then
clonedpart.Color = Color3.new(1, 1, 0)
end
if randomcolor == 3 then
clonedpart.Color = Color3.new(1, 1, 1)
end
if randomcolor == 3 then
clonedpart.Color = Color3.new(0, 0, 0)
end
end
end
while true do
wait(0.1)
local clone = script:Clone()
clone.Parent = folder:WaitForChild("ClonedPart")
end
Script 2 (This isn't faling or something, I just add it in case someone need it)
```lua
local color = math.random(0,255)
for i = 1,10000 do
local size = math.random(100,2048)
local planet = Instance.new("Part")
local pos1 = math.random(1,250000)
local pos2 = math.random(1,250000)
local pos3 = math.random(1,250000)
wait(0.03)
planet.Shape = "Ball"
planet.Parent = game.Workspace.Planets
planet.Size = Vector3.new(size,size,size)
planet.Anchored = true
planet.Material = "SmoothPlastic"
planet.Name = "ClonedPlanet"
planet.Position = Vector3.new(pos1,pos2,pos3)
planet.Color = Color3.new(1, 0, 0)
end