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: Dynamic Lighting New Part

Previous Thread :: Next Thread 
VaCheesehead is not online. VaCheesehead
Joined: 03 Feb 2013
Total Posts: 115
26 May 2013 11:10 AM
Hey I'm trying to make snow on my place and I am using a brick that just drops other bricks however I want to add a function so that all new bricks are created with a point light in them. This is the script:

function fire()
local p = Instance.new("Part")
p.Position = script.Parent.Position
p.Size = Vector3.new(2,3,2)
p.BrickColor = BrickColor.new("Institutional White")
p.BottomSurface = 0
p.TopSurface = 0
p.CanCollide = false
p.Name = "KillBrick" --DO NOT CHANGE/REMOVE
p.Parent = script.Parent

local DmgScript = script.Parent.KillScript:Clone() -- The damage script clone
DmgScript.Disabled = false --Enable the clone of it
DmgScript.Parent = p
end

while true do
wait(1) --Alter Rate Of Drop
fire()
end

Am curious to where and how to add lighting script. Please ignore the "killbrick" function, it was for acid raid but changed it to snow now.
Report Abuse
VaCheesehead is not online. VaCheesehead
Joined: 03 Feb 2013
Total Posts: 115
26 May 2013 12:16 PM
The original part has a point light but I am having trouble recreating it in the clone.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
26 May 2013 12:18 PM
put this into the fire function

local light = Instance.new("PointLight", p)
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
26 May 2013 12:19 PM
Just add it after the p.Parent = script.Parent

light = Instance.new("PointLight")
light.Parent = p
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
26 May 2013 12:20 PM
function fire()
local p = Instance.new("Part")
p.Position = script.Parent.Position
p.Size = Vector3.new(2,3,2)
p.BrickColor = BrickColor.new("Institutional White")
p.BottomSurface = 0
p.TopSurface = 0
p.CanCollide = false
p.Name = "KillBrick" --DO NOT CHANGE/REMOVE
p.Parent = script.Parent

--What was added v
---------------------------------------------
l = Instance.new("PointLight")
l.Parent = p
---------------------------------------------
local DmgScript = script.Parent.KillScript:Clone() -- The damage script clone
DmgScript.Disabled = false --Enable the clone of it
DmgScript.Parent = p
end

while true do
wait(1) --Alter Rate Of Drop
fire()
end

---------------------------------------------
This may not work, so let me know if it does/doesn't.

-Bogy
Report Abuse
VaCheesehead is not online. VaCheesehead
Joined: 03 Feb 2013
Total Posts: 115
26 May 2013 12:24 PM
Added it in second line:

function fire()
local p = Instance.new("Part")
local light = Instance.new("PointLight", p)
p.Position = script.Parent.Position
p.Size = Vector3.new(2,3,2)
p.BrickColor = BrickColor.new("Institutional white")
p.BottomSurface = 0
p.TopSurface = 0
p.CanCollide = false
p.Name = "KillBrick" --DO NOT CHANGE/REMOVE
p.Parent = script.Parent


local DmgScript = script.Parent.KillScript:Clone() -- The damage script clone
DmgScript.Disabled = false --Enable the clone of it
DmgScript.Parent = p
end

while true do
wait(1) --Alter Rate Of Drop
fire()
end

Works good now but i tried to adjust the brightness and range and didnt work.
I tried putting in:
light.brightness = 10
light.range = 10
but nothing happened.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
26 May 2013 12:26 PM
capital letters

light.Range
light.Brightness

make sure it's EXACTLY after instancing the light
Report Abuse
VaCheesehead is not online. VaCheesehead
Joined: 03 Feb 2013
Total Posts: 115
26 May 2013 12:28 PM
Yep that works, of course only thing I did wrong was capitalization lol, thanks for help.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
26 May 2013 12:29 PM
yeah np
Report Abuse
VaCheesehead is not online. VaCheesehead
Joined: 03 Feb 2013
Total Posts: 115
26 May 2013 12:37 PM
Although that is all I need, how could you change the speed and direction the new brick falls in? Like making it come in from the side. One thing I am trying for speed is:
local s = Instance.new ("Speed",p)
s.Value = ?-Speed example?
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
26 May 2013 12:41 PM
BodyVelocity

wiki it or something
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