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: Can't insert a brick into currentcamera.

Previous Thread :: Next Thread 
JohnElijah is not online. JohnElijah
Joined: 06 May 2009
Total Posts: 1629
25 Aug 2013 11:21 PM
Well I want to create a brick that is only visible to the current player. Yes it is a local script.

local cam = game.Workspace.CurrentCamera
do
wait()
local block = Instance.new("Part")
block.Name = "Block"
block.Parent = cam
block.Color = Color3.new(math.random())
end


Any help on what I did wrong?
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
25 Aug 2013 11:25 PM
I think the color might be wrong
Report Abuse
JohnElijah is not online. JohnElijah
Joined: 06 May 2009
Total Posts: 1629
25 Aug 2013 11:26 PM
@mad

The color is random. Thanks for the useful information.
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
25 Aug 2013 11:35 PM
I know the color is Random, But I think you would have to do random, random, random or something like that
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
25 Aug 2013 11:43 PM
change "block.Color = Color3.new(math.random())"
to

block.BrickColor = BrickColor.Random()
Report Abuse
RobustPhysics is not online. RobustPhysics
Joined: 12 Jul 2012
Total Posts: 3064
25 Aug 2013 11:55 PM
Testing it right now and it works fine.

local cam = game.Workspace.CurrentCamera
while wait(0.2) do --I assume it was mean to be a loop?
local block = Instance.new("Part")
block.Name = "Block"
block.Parent = cam
block.Color = Color3.new(math.random(),math.random(),math.random())
--block.BrickColor = BrickColor.Random() works just as well
block.CFrame = CFrame.new(0,20,0) --I found that if I didn't position it, it just fell off the map.
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
25 Aug 2013 11:56 PM
You can't Color3 on a Part.

Also, no he didn't mean a loop.
Report Abuse
RobustPhysics is not online. RobustPhysics
Joined: 12 Jul 2012
Total Posts: 3064
26 Aug 2013 12:00 AM
Really? What's the purpose of using just "do" then?

Surprisingly, you can change a parts color using Color3. Instead of using BrickColor, just use Color.

workspace.Part.Color = Color3.new(1,1,1)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Aug 2013 12:02 AM
Since when? Oh well

Also, it's probably so he can add a place so he can "minimize" that part of the script.
(Like that minus button on the left-side)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Aug 2013 02:47 AM
You can't really change the part's color into a Color3 value, though with the .Color property, it'll give you the closest BrickColor match.
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
26 Aug 2013 04:46 AM
"Purpose of a do - end block".

Local variables. It creates a new scope. Example;

a = 3
do
local a = 2
print(a)
end
print(a)
do
print(a)
end

prints:
2
3
3

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