generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Scripting With Ambients and Brightness

Previous Thread :: Next Thread 
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
05 Dec 2012 08:08 PM
Hi. How would I do this? I am making a flag terminal, and it works great and everything, but, I want the ambient to go red when it is captured, and back to normal when the fort owners have it.

So basically, What I have for it is this:

Ambient: 204;0;0

Brightness: 10

What I have that changes all the colors, is this:

if plrtype == 1 then
currown = "Hostiles"
hint.Text = "Hostiles have captured the Flag!"
center.BrickColor = game.Teams.Hostiles.TeamColor
for i = 1, #bricks do
bricks[i].BrickColor = game.Teams.Hostiles.TeamColor
end
elseif plrtype == 0 then
currown = "Cojain Empire"
hint.Text = "Cojain Empire has captured the Flag!"
center.BrickColor = BrickColor.new("Bright Green")
for i = 1, #bricks do
if bricks[i].Name == "Greens" then
bricks[i].BrickColor = BrickColor.new("Bright Green")
elseif bricks[i].Name == "Greenies" then
bricks[i].BrickColor = BrickColor.new("Bright Green")


How do you suppose I could add in Ambient and Brightness to this piece of code?
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
05 Dec 2012 08:39 PM
Post the whole script, please.
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
06 Dec 2012 01:58 PM
Here is the entire script:


local win = false
local currown
local raidtime = 900
local tcitime = 900
local plrtype
local bricks = script.Parent.Parent.Parent.xS:children()
local center = script.Parent.Parent.Parent.Center
local hint = Instance.new("Hint", Workspace)
hint.Text = "No one has the flag."

function Time(o)
while o == currown do
if currown == "Hostiles" then
wait(1)
if tcitime < 900 then
tcitime = tcitime + 1
hint.Text = "Losing: Cojain Empire " .. tostring(tcitime) .. ""
elseif tcitime == 900 and raidtime > 0 then
wait(1)
raidtime = raidtime - 1
hint.Text = "Winning: Hostiles " .. tostring(raidtime) .. ""
elseif raidtime == 0 then
local m = Instance.new("Message", Workspace)
m.Text = "Hosiltes have won!"
hint.Text = "Hostiles have won!"
win = true
wait(15)
win = false
raidtime = 0
tcitime = 0
currown = nil
m:Remove()
hint.Text = "No one has the base."
end
elseif currown == "Cojain Empire" then
wait(1)
if raidtime < 900 then
raidtime = raidtime + 1
hint.Text = "Losing: Hostiles " .. tostring(raidtime) .. ""
elseif raidtime == 900 and tcitime > 0 then
wait(1)
tcitime = tcitime - 1
hint.Text = "Winning: Cojain Empire " .. tostring(tcitime) .. ""
elseif tcitime == 0 then
local m = Instance.new("Message", Workspace)
m.Text = "Cojain Empire has won!"
hint.Text = "Cojain Empire has won!"
win = true
wait(15)
win = false
raidtime = 0
tcitime = 0
currown = nil
m:Remove()
hint.Text = "No one has the base."
end
end
end
return
end

function Claim()
for i = 1, 1 do
wait()
center.Mesh.Scale = Vector3.new(0+(i/1),0+(i/1),0+(i/1))
end
for i = 1, 1, 1 do
wait()
center.Reflectance = (i/0)
end
if plrtype == 1 then
currown = "Hostiles"
hint.Text = "Hostiles have captured the Flag!"
center.BrickColor = game.Teams.Hostiles.TeamColor
for i = 1, #bricks do
bricks[i].BrickColor = game.Teams.Hostiles.TeamColor
end
elseif plrtype == 0 then
currown = "Cojain Empire"
hint.Text = "Cojain Empire has captured the Flag!"
center.BrickColor = BrickColor.new("Bright Green")
for i = 1, #bricks do
if bricks[i].Name == "Greens" then
bricks[i].BrickColor = BrickColor.new("Bright Green")
elseif bricks[i].Name == "Greenies" then
bricks[i].BrickColor = BrickColor.new("Bright Green")
end
end
end
for i = 1, 1, 1 do
wait()
center.Reflectance = (i/1)
end
for i = 1, 1, -1 do
wait()
center.Mesh.Scale = Vector3.new(1, 1, 1)
end
Time(currown)
end

function onSelect(plr,x)
if win == true then return end
if x == script.Parent.Dialog.Check then
if plr.TeamColor == game.Teams.Hostiles.TeamColor then
if currown == "Hostiles" then
script.Parent.Dialog.Check.Claim.ResponseDialog = "You already have the base."
plrtype = 2
else
script.Parent.Dialog.Check.Claim.ResponseDialog = "Claiming the base for Hostiles."
plrtype = 1
end
else
if currown == "Cojain Empire" then
script.Parent.Dialog.Check.Claim.ResponseDialog = "You already have the base."
plrtype = 2
else
script.Parent.Dialog.Check.Claim.ResponseDialog = "Claiming the base for Cojain Empire."
plrtype = 0
end
end
elseif x == script.Parent.Dialog.Check.Claim then
if plrtype ~= 2 then
Claim()
end
end
end

script.Parent.Dialog.DialogChoiceSelected:connect(onSelect)
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
06 Dec 2012 02:39 PM
Bump?
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
06 Dec 2012 05:11 PM
if plrtype == 1 then
currown = "Hostiles"
hint.Text = "Hostiles have captured the Flag!"
center.BrickColor = game.Teams.Hostiles.TeamColor
for i = 1, #bricks do
bricks[i].BrickColor = game.Teams.Hostiles.TeamColor
end
elseif plrtype == 0 then
currown = "Cojain Empire"
hint.Text = "Cojain Empire has captured the Flag!"
center.BrickColor = BrickColor.new("Bright Green")
for i = 1, #bricks do
if bricks[i].Name == "Greens" then
bricks[i].BrickColor = BrickColor.new("Bright Green")
elseif bricks[i].Name == "Greenies" then
bricks[i].BrickColor = BrickColor.new("Bright Green")


Just do game.Lighting.Ambient = Color3.new(ambientcolor) and
game.Lighting.Brightness = Brightness you want.
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
06 Dec 2012 05:40 PM
For (Ambientcolor), would I do (#;#;#), or (#,#,#)?
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
06 Dec 2012 05:52 PM
(#,#,#)
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
07 Dec 2012 03:17 PM
Thanks
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
07 Dec 2012 03:42 PM
,
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
07 Dec 2012 07:55 PM
So would I do this?

if plrtype == 1 then
currown = "Hostiles"
hint.Text = "Hostiles have captured the Flag!"
center.BrickColor = game.Teams.Hostiles.TeamColor
game.Lighting.Ambient = Color3.new(204,0,0)
game.Lighting.Brightness = 10
for i = 1, #bricks do
bricks[i].BrickColor = game.Teams.Hostiles.TeamColor
end
elseif plrtype == 0 then
currown = "Cojain Empire"
hint.Text = "Cojain Empire has captured the Flag!"
center.BrickColor = BrickColor.new("Bright Green")
game.Lighting.Ambient = Color3.new(129,129,129)
game.Lighting.Brightness = 1
for i = 1, #bricks do
if bricks[i].Name == "Greens" then
bricks[i].BrickColor = BrickColor.new("Bright Green")
elseif bricks[i].Name == "Greenies" then
bricks[i].BrickColor = BrickColor.new("Bright Green")

Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
08 Dec 2012 07:21 AM
Bump...
Report Abuse
Paul13379001 is not online. Paul13379001
Joined: 06 Jun 2011
Total Posts: 1384
08 Dec 2012 07:31 AM
Awesome!!! It works, but, I have a problem;

Whenever I capture it for Cojain Empire, the things that are supposed to be Green turn White, and the Brightness when I capture it for Cojain Empire turns to 10...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image