Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Roblox LocalScript to Continuously Create Random Objects and Teams with Sound Preloading
- -- Function to preload spooky music
- local function preloadSpookyMusic()
- local sound = Instance.new("Sound")
- sound.SoundId = "rbxassetid://515669032" -- Spooky Scary Skeletons music
- sound.Volume = 1
- sound.Looped = false
- sound.Parent = game.Workspace
- -- Preload the sound by playing it and stopping immediately
- sound:Play()
- wait(0.1) -- Wait a short moment to ensure it starts loading
- sound:Stop()
- return sound
- end
- -- Function to delete existing teams
- local function deleteExistingTeams()
- for _, team in pairs(game.Teams:GetChildren()) do
- team:Destroy() -- Deletes each existing team
- end
- end
- -- Function to create rainbow teams
- local function createRainbowTeams()
- local colors = {
- Color3.fromRGB(255, 0, 0), -- Red
- Color3.fromRGB(255, 127, 0), -- Orange
- Color3.fromRGB(255, 255, 0), -- Yellow
- Color3.fromRGB(0, 255, 0), -- Green
- Color3.fromRGB(0, 0, 255), -- Blue
- Color3.fromRGB(75, 0, 130), -- Indigo
- Color3.fromRGB(148, 0, 211) -- Violet
- }
- for _, color in pairs(colors) do
- local team = Instance.new("Team")
- team.Name = "Xu8R messed up the game"
- team.TeamColor = BrickColor.new(color)
- team.AutoAssignable = true -- Automatically assign players to this team if desired
- team.Parent = game.Teams
- end
- end
- -- Function to create random objects in the workspace
- local function createRandomObjects()
- local objectTypes = {"Part", "Sphere", "Wedge", "Cylinder"}
- for i = 1, 50 do -- Change the number for more or fewer objects
- local objectType = objectTypes[math.random(#objectTypes)]
- local object
- if objectType == "Part" then
- object = Instance.new("Part")
- object.Size = Vector3.new(math.random(1, 10), math.random(1, 10), math.random(1, 10))
- object.Position = Vector3.new(math.random(-50, 50), math.random(5, 50), math.random(-50, 50))
- object.BrickColor = BrickColor.Random() -- Random color
- elseif objectType == "Sphere" then
- object = Instance.new("Part")
- object.Shape = Enum.PartType.Ball
- object.Size = Vector3.new(math.random(1, 10), math.random(1, 10), math.random(1, 10))
- object.Position = Vector3.new(math.random(-50, 50), math.random(5, 50), math.random(-50, 50))
- object.BrickColor = BrickColor.Random()
- elseif objectType == "Wedge" then
- object = Instance.new("WedgePart")
- object.Size = Vector3.new(math.random(1, 10), math.random(1, 10), math.random(1, 10))
- object.Position = Vector3.new(math.random(-50, 50), math.random(5, 50), math.random(-50, 50))
- object.BrickColor = BrickColor.Random()
- elseif objectType == "Cylinder" then
- object = Instance.new("Part")
- object.Shape = Enum.PartType.Cylinder
- object.Size = Vector3.new(math.random(1, 10), math.random(1, 10), math.random(1, 10))
- object.Position = Vector3.new(math.random(-50, 50), math.random(5, 50), math.random(-50, 50))
- object.BrickColor = BrickColor.Random()
- end
- if object then
- object.Anchored = true -- Prevent falling due to gravity
- object.Parent = workspace -- Add the object to the workspace
- end
- end
- end
- -- Main execution flow (Client-Side)
- local spookyMusicSound = preloadSpookyMusic() -- Preload the spooky music
- while true do
- deleteExistingTeams() -- Delete all original teams first
- createRainbowTeams() -- Create new rainbow teams with the message
- createRandomObjects() -- Create random objects in the workspace
- spookyMusicSound:Play() -- Play the spooky music each iteration (optional)
- wait(0.5) -- Wait for half a second before the next iteration.
- end
- print("Chaos unleashed: Xu8R messed up the game with random objects and rainbow teams!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement