Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[a script that randomizes the map, made for roblox]]
- --[[levels:
- 1 = color
- 2 = color, material
- 3 = color, material, size,
- 4 = color, material, size, position
- 5 = color, material, size, position, orientation
- 6 = color, material, size, position, orientation, velocity
- 7 = color, material, size, position^2, orientation, velocity
- (extras)
- 5.1 = color, material, size, position^2, orientation
- 5.2 = color, material, size, position, orientation, transparency
- ]]
- local levelofrandomization = 3
- local zoneofpositionpowertwo = 2048 --[[ the zone for position^2, used for randomization level 7]]
- local maxsize = 128 --[[max size for randomization, used for randomization level 3+]]
- local maxoffset = 128 -- [[max offset for randomization, used for randomization level 4+, 6-]]
- local maxdegree = 180 -- [[max angle for randomization, used for randomization level 5+]]
- local maxvelocity = 128 -- [[max velocity for randomization, used for randomization level 6+]]
- local offsetposition = false -- [[offset increase depends on size also, used for randomization level 4+, 6-]]
- local offsetsize = false -- [[offset of size adds/removes, instead of sets, used for randomization level 3+]]
- local offsetangle = false --[[offset of orientation adds/removes, instead of sets, used for randomization level 5+]]
- local offsetvelocity = false --[[offset of velocity adds/removes, instead of sets, used for randomization level 6+]]
- local lesslag = false --[[ use if theres like alot of parts in the map]]
- local old = false -- [[the old variation of this script, only checks for parts, and uses GetChildren instead]]
- local childaddedrandomize = false -- [[randomized the part when it gets added aswell]]
- function randomizepart(obj)
- if levelofrandomization >= 1 then
- obj.Color = Color3.new(math.random(),math.random(),math.random())
- if obj:IsA("UnionOperation") then
- obj.UsePartColor = true
- end
- end
- if levelofrandomization >= 2 then
- obj.Material = Enum.Material:GetEnumItems()[math.random(1,#Enum.Material:GetEnumItems())]
- end
- if levelofrandomization >= 3 then
- if offsetsize then
- obj.Size = Vector3.new(obj.Size.X+math.random(-(obj.Size.X-1),maxsize),obj.Size.Y+math.random(-(obj.Size.Y-1),maxsize),obj.Size.Z+math.random(-(obj.Size.Z-1),maxsize))
- else
- obj.Size = Vector3.new(math.random(0.05,maxsize),math.random(0.05,maxsize),math.random(0.05,maxsize))
- end
- end
- if levelofrandomization >= 4 then
- if levelofrandomization ~= 7 then
- if offsetposition then
- obj.Position = Vector3.new(obj.Position.X+obj.Position.X+math.random(-maxoffset,maxoffset),obj.Position.Y+obj.Position.Y+math.random(-maxoffset,maxoffset),obj.Position.Z+obj.Position.Z+math.random(-maxoffset,maxoffset))
- else
- obj.Position = Vector3.new(obj.Position.X+math.random(-maxoffset,maxoffset),obj.Position.Y+math.random(-maxoffset,maxoffset),obj.Position.Z+math.random(-maxoffset,maxoffset))
- end
- else
- obj.Position = Vector3.new(math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo),math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo),math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo))
- end
- end
- if levelofrandomization >= 5 then
- if offsetangle then
- obj.Orientation = Vector3.new(obj.Orientation.X+math.random(-maxdegree,maxdegree),obj.Orientation.Y+math.random(-maxdegree,maxdegree),obj.Orientation.Z+math.random(-maxdegree,maxdegree))
- else
- obj.Orientation = Vector3.new(math.random(-maxdegree,maxdegree),math.random(-maxdegree,maxdegree),math.random(-maxdegree,maxdegree))
- end
- end
- if levelofrandomization >= 6 then
- if offsetvelocity then
- obj.Velocity = Vector3.new(obj.Velocity.X+math.random(-maxvelocity,maxvelocity),obj.Velocity.Y+math.random(-maxvelocity,maxvelocity),obj.Velocity.Z+math.random(-maxvelocity,maxvelocity))
- else
- obj.Velocity = Vector3.new(math.random(-maxvelocity,maxvelocity),math.random(-maxvelocity,maxvelocity),math.random(-maxvelocity,maxvelocity))
- end
- end
- if levelofrandomization == 5.1 then
- obj.Position = Vector3.new(math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo),math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo),math.random(-zoneofpositionpowertwo,zoneofpositionpowertwo))
- end
- if levelofrandomization == 5.2 then
- obj.Transparency = math.random(0.0,0.9)
- end
- end
- if old then
- for i,v in pairs(workspace:GetChildren()) do
- if v:IsA("Part") then
- randomizepart(v)
- end
- if lesslag then
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- else
- for i,v in pairs(workspace:GetDescendants()) do
- if v:IsA("BasePart") then
- randomizepart(v)
- end
- if lesslag then
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- end
- if childaddedrandomize then
- workspace.ChildAdded:Connect(function(obj)
- randomizepart(obj)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement