|
| 29 Mar 2016 08:14 AM |
Hi I'm new to scripting and have learned much of the basics from wiki and all... And now I want to put my knowledge that I have so far to the test by creating a simple script of something. Can you guys leave a suggestion on what I should script? |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 08:15 AM |
when you click a brick, make it change to a random color?
It's simple physics R$143 |
|
|
| Report Abuse |
|
|
Royal_Zey
|
  |
| Joined: 25 Mar 2016 |
| Total Posts: 233 |
|
|
| 29 Mar 2016 08:20 AM |
--If you fail, here's the code to make the random colored brick, it could've been way simpler but yeah consider it as a function lel
local Brick = game.Workspace.Part;
function RandomColor(Obj) math.randomseed(tick()) local RandR,RandG,RandB=math.random(),math.random(),math.random() Obj.BrickColor = Color3.new(RandR,RandG,RandB) print(RandR,RandG,RandB.." are the new Color3 values for "..Obj.Name.."'s BrickColor") end
Brick.Touched:connect(function() RandomColor(Brick) end)
|
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 08:28 AM |
Or you could do:
local Brick = game.workspace.Part
function ChangeColor(Obj) local Number = math.random(1,355) Obj.BrickColor = BrickColor.new(Color3.new(Number,Number,Number)) end
Brick.Touched:connect(ChangeColor) |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 08:32 AM |
or...
brick.Touched:connect(function() brick.BrickColor = BrickColor.random() end)
#code R+ | local RAP = "R$383,771"; local robux = "R$1,982" |
|
|
| Report Abuse |
|
|
Royal_Zey
|
  |
| Joined: 25 Mar 2016 |
| Total Posts: 233 |
|
|
| 29 Mar 2016 08:34 AM |
@Extreme
2 things
1) if the number is above 255 then, well yeah lol. 2) you're using the same number in R,G and B so it'll return white xd |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 08:44 AM |
Well I did this:
local part = script.Parent
function onClicked() part.BrickColor = BrickColor.Random() end
part.ClickDetector.MouseClick:connect(onClicked)
Seeing these script: They're more complex than this xD. But I can understand it (Kinda).
|
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 08:47 AM |
@Royal lol, waking up and being tired are two worst things when scripting....
except for coffee spills ;p |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 09:51 AM |
@Royal_Zay your script somehow failed with: "Obj.Brickcolor = Color3.new(RandR,RandG,RandB)" Changin Color3 to BrickColor seems to fix it...
(So: "Obj.BrickColor = BrickColor.new(RandR,RandG,RandB)" |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 09:57 AM |
You noobs might use 0-255, but Color3 goes from 0 to 1
local r = math.random(0,255) local g = math.random(0,255) local b = math.random(0,255) local color = BrickColor.new(Color3.new(r/255,g/255,b/255))
All of that is unnescascery however as
BrickColor.Random()
exist.. |
|
|
| Report Abuse |
|
|