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: Wondering..

Previous Thread :: Next Thread 
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 10:38 AM
Is there a command to see while something is being touched.
Let's say I have a brick and I need it so while it's being touched it will turn red while it's not being toched it will turn blue.

And no I don't mean the touched function.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 10:40 AM
.Touched event and .TouchedEnded event.
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 10:40 AM
Could you give me an example of it in a script?
Thanks.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 10:42 AM
Sorry, TouchEnded*

http://wiki.roblox.com/index.php/TouchEnded_(Event)
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 10:44 AM
No I wanted it so it's like this.


a = script.parent

beingtouched = False

While touched do
beingtouched = true
end

Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 10:45 AM
TOO BAD!
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 10:46 AM
Nice spam post.
.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 10:49 AM
Yes, you did make a nice spam post, :3.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 10:50 AM
Just use magnitude... I was hoping you'd get the memo. I mean really, there are tons of ways to do this, -_-...
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:20 AM
Well I don't get it. sooo yeah..

Bump.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Aug 2012 11:23 AM
beingtouched = false

script.Parent.Touched:connect(fucntion()
beingtouched = true
end)

script.Parent.TouchEnded:connect(fucntion()
beingtouched = false
end)
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:24 AM
Thanks that's just what I was looking for. :3
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:31 AM
I tried this

local self = script.Parent
local beingtouched = false

script.Parent.Touched:connect(fucntion()
beingtouched = true
self.BrickColor = BrickColor.new("Blue")
end)

script.Parent.TouchEnded:connect(fucntion()
beingtouched = false
self.BrickColor = BrickColor.new("Gray")
end)


12:29:07 - Workspace.Part.Script:5: ')' expected (to close '(' at line 4) near 'beingtouched'
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Aug 2012 11:33 AM
script.Parent.Touched:connect(fucntion()
script.Parent.BrickColor = BrickColor.new("Blue")
end)

script.Parent.TouchEnded:connect(fucntion()
script.Parent.BrickColor = BrickColor.new("Gray")
end)
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:39 AM
I don't see what you changed.

I had a variable called self.

Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:39 AM
I tried

script.Parent.Touched:connect(fucntion()
script.Parent.BrickColor = BrickColor.new("Blue")
end)

script.Parent.TouchEnded:connect(fucntion()
script.Parent.BrickColor = BrickColor.new("Gray")
end)


But got this in output again

Workspace.Part.Script:2: ')' expected (to close '(' at line 1) near 'script'
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Aug 2012 11:39 AM
Also I don't think "Blue" and "Gray" are brick colors... Just use it.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Aug 2012 11:40 AM
OH WOW, I spelt Fucntion, not function for both of them.. Here:

script.Parent.Touched:connect(function()
script.Parent.BrickColor = BrickColor.new("Navy blue")
end)

script.Parent.TouchEnded:connect(function()
script.Parent.BrickColor = BrickColor.new("Gray")
end)
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
19 Aug 2012 11:41 AM
local self = script.Parent
local touches = 0

self.Touched:connect(function ()
touches = touches + 1
self.BrickColor = BrickColor.new("Blue")
end)

self.TouchEnded:connect(function ()
touches = math.max(touches - 1, 0) -- just in case, we don't want to go negative

if touches == 0 then
self.BrickColor = BrickColor.new("Gray")
end
end)

This better supports multiple objects touching this part.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 11:42 AM
Bright blue and Medium stone grey.
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 11:42 AM
Thanks man it worked.

:D
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Aug 2012 11:42 AM
You're welcome.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
19 Aug 2012 11:43 AM
@Care he could have been talking to you, or the two above you...
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
19 Aug 2012 12:02 PM
I was talking to 18cwat.

Care did pretty much nothing for me.
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