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: Help with an onTouched function

Previous Thread :: Next Thread 
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 10:36 AM
I'm making a game about smashing things. The problem is that when I use a tool to hit something that is stationary, it won't do anything. But when I move the tool around while I hit the object, like move my character side to side, it damages the object as intended. Is there any explanation to this?
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
13 Apr 2014 11:13 AM
Post the script?
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 11:35 AM
enabled = true

function onTouched(h)
if enabled == true then
if h.Name == "PUTIS" then
if h.Transparency ~= 1 then
enabled = false
h.Parent.Humanoid.Health = h.Parent.Humanoid.Health - 25
wait(1)
enabled = true
end
end
end
end

script.Parent.Touched:connect(onTouched)

Backround: The object's name is PUTIS. The script is in a part in a tool.
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 11:49 AM
b1
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 12:33 PM
b2
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 01:15 PM
b3
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 01:36 PM
does anybody know?
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 02:25 PM
b4
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 02:38 PM
b5
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 02:58 PM
b6 :(
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
13 Apr 2014 03:01 PM
script.Parent.Touched:connect(function(p)
if p.Parent.ClassName == "Tool" then
script.Parent.BrickHealth.Health = 0
end
end)

inside the brick
if a tool touches it
boosh
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
13 Apr 2014 03:02 PM
Nothing wrong with it
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 03:31 PM
@Blade
Same outcome.
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 05:56 PM
b7
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 06:35 PM
b8
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 07:37 PM
b9
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 08:45 PM
*sigh* b10
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 09:52 PM
b11
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 10:02 PM
I thought this was scripting helpers.

b12
Report Abuse
2unknown2 is not online. 2unknown2
Joined: 30 Oct 2011
Total Posts: 9351
13 Apr 2014 10:20 PM
enabled = true

script.Parent.Touched:connect(function(h)
if enabled == true and h and h.Parent:findFirstChild("Humanoid") then
if h.Name == "PUTIS" then
if h.Transparency ~= 1 then
enabled = false
h.Parent.Humanoid.Health = h.Parent.Humanoid.Health - 25
wait(1)
enabled = true
end
end
end
end)

Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 10:35 PM
Yea, that didn't work either. I'm beginning to think that this isn't a scripting error but an error on ROBLOX's part.
Report Abuse
2unknown2 is not online. 2unknown2
Joined: 30 Oct 2011
Total Posts: 9351
13 Apr 2014 10:36 PM
make a join.me or something so i can see full thing
Report Abuse
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
13 Apr 2014 10:41 PM
join.me? Never heard of it
Report Abuse
2unknown2 is not online. 2unknown2
Joined: 30 Oct 2011
Total Posts: 9351
13 Apr 2014 10:42 PM
its like a screen share thing

just go to

join.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