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: Trying to make color change when a block moves.

Previous Thread :: Next Thread 
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
08 Mar 2014 01:25 PM
---
if game.Workspace.Door.Position == (169.1, 4.9, 178) then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif game.Workspace.Door.Position => (169.1, 4.9, 178) then
script.Parent.BrickColor = BrickColor.new("Lime green")
end
---

I'm basically trying to make script.Parent turn Lime Green whenever the object called Door moves up. It doesn't do anything though.

Output:
Workspace.Part.Script:1: ')' expected near ','
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
08 Mar 2014 01:28 PM
bump
Report Abuse
warriorqaz is not online. warriorqaz
Joined: 09 Oct 2009
Total Posts: 726
08 Mar 2014 01:32 PM
So is the purpose of this for a door to open and then change colors?
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
08 Mar 2014 01:33 PM
First line. It needs to be a Vector3 value.

-->if game.Workspace.Door.Position == Vector3.new(169.1,4.9,178) then
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
08 Mar 2014 01:35 PM
And 3rd line can't work like that . If its just the height of the doors which varies compare only the Y axis values.
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
08 Mar 2014 01:38 PM
if game.Workspace.Door.Position == Vector3.new (169.1, 4.9, 178) then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif game.Workspace.Door.Position > (169.1, 4.9, 178) then
script.Parent.BrickColor = BrickColor.new("Lime green")
end
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
08 Mar 2014 01:41 PM
But billy at the third line. You can't compare two vector3 values like that.
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
08 Mar 2014 02:25 PM
So, how would I compare just the y axis values?
I'm going to assume using Vector3.y?
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
08 Mar 2014 03:05 PM
elseif game.Workspace.Door.Position.Y >= 4.9 then
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
08 Mar 2014 10:13 PM
My new script is

---
if game.Workspace.Door.Position == Vector3.new (169.1, 4.9, 178) then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif game.Workspace.Door.Position.Y >= (4.9) then
script.Parent.BrickColor = BrickColor.new("Lime green")
end
---

It's just stuck on lime green.
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
09 Mar 2014 06:53 AM
That is because at line one you ask if it has a height equal to 4.9, at line three you ask if it is either EQUAL (again) or bigger than 4.9
So remove the equal sign at the third line. ;)
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
09 Mar 2014 09:38 AM
okay... it's still stuck lime green.
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
09 Mar 2014 09:56 AM
Even if you write it like this?
--

if game.Workspace.Door.Position.Y == 4.9 then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif game.Workspace.Door.Position.Y > (4.9) then
script.Parent.BrickColor = BrickColor.new("Lime green")
end

--
If it is still always lime green, probably your door isn`t really at a height of 4.9 anytime?
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
09 Mar 2014 10:29 AM
Nope, I checked. Still 4.9.

I tried making the position be greater than 5, and that makes it stuck red.
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
09 Mar 2014 10:43 AM
Then your problem is probably with whatever script moves your up or random ``Duh``
mistake elsewhere. That`s all I can say.
Report Abuse
Bobogijoe is not online. Bobogijoe
Joined: 04 Mar 2010
Total Posts: 640
09 Mar 2014 10:44 AM
your door*
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