Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making the ambient disco like with a command?

Okay so I'm working on SIMPLE admin commands for my place. And I'm on the fun commands at the moment. So I wanted to make a command where when one of the admins says the word 'Disco' then it makes the ambient start changing and making it disco like.

This is what I have so far.

function Disco(msg)
	Player = script.Parent.Parent
	  if Player.Name == "shockyman101" or "17jdillon" or "DeathPossession" then
		if msg == "Disco" or msg == "disco" then
			while true do --The disco will be a loop of colors playing over and over I wanted to use BrickColor.Random() but it has to be Color3 so I did not know.
				
				
				
		 
      end
	 end
	end	
   end
script.Parent.Parent.Chatted:connect(Speed)


If you have an idea of how to help me I'd much appreciate it. :) thanks. ~Shocky

2 comments

0

Maybe use GUIs?

0

Like have sever GUI's changing colors but with their transparency's being .8 or such?

1 answer

✓ Accepted answer

Hmm, you could probly do it by using the Lighting's Services Ambient, let me show you;

local color = Color3.new(math.random(0,255),math.random(0,255),math.random(0,255)) --This'll do the colors by random (Uses Color3)
local Lighting = game:GetService("Lighting") --Lets use this instead of doing 'game.Lighting' so many times for the code :P

repeat wait(.1) --This will repeat waiting 0.10 (Tenths of a millisecond)
Lighting.Ambient = color --The Lighting's Ambient Color will be change by random
Lighting.FogColor = color --The Lighting's FogColor will also be changed by random
Lighting.OutdoorAmbient = color --The Lighting's OutdoorAmbient's Color will, aswell, be changed by random
until nil --This will repeat the code until the script is either disabled, or removed, if you want me to edit my answer further, to have it support stopping the Disco, just let me know :)

Oh, also, you coded your script wrong, lets remake it;

local Admins = {"yournamehere"} --This is where which people can use the command

local function ChkAdmin(plr,str) --I like to use this to check if the player is in the Admins list
for i = 1, #Admins do if plr:lower() == Admins[i]:lower() then return true end end --If the Player is in the list, then the code will return true to the player being an admin
return false --Elseif isn't :P
end --The end to end this function

local function onChat(plr,msg) --Lets use this instead

if msg:lower() == "disco" then --If the player (If is an Admin) chatted 'Disco'
if plr then --If the player exists then
--What to do here
end --The end to end the 'if' statement
end --The end to end the 'if' statement (The first one)

end --The end to end the function

local function AdminControl(plr) --Now, lets use a seperate function
if ChkAdmin(plr.Name,false) then plr.Chatted:connect(function(msg) onChat(plr,msg) end) end --If the Player that has joined is an Admin then it'll connect 'onChat' to the Player, allowing him/her to use the command
end --The end to end the function

game.Players.PlayerAdded:connect(AdminControl) --Now when a player joins, it'll connect AdminControl to the Player
for i,v in pairs(game.Players:GetPlayers()) do AdminControl(v) end --I do this as a just-in-case, this do AdminControl on all players currently in the server

Hope this helped!

2 comments

0

Thanks so much for the help, also with including something I've never used such as repeat until!

0

No problem bro. :) We all learn something new everyday. Haha! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.