|
| 21 Mar 2014 02:09 AM |
damage = 100 ball = script.Parent function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid ~= nil then humanoid.Health = humanoid.Health - damage wait(2) elseif hit.BrickColor == BrickColor.new("Reddish brown") then hit:Remove() end
connection:disconnect() end connection = ball.Touched:connect(onTouched)
What this is doing is basically I have a ball placed on your humanoid's position, anchored. That ball waits 5 seconds, then has a square block spawn around it. This script is inside of the square block, and I know this because the square block WILL kill me, but doesn't remove the block that is Reddish brown. I've tried this script with a free model projectile, and it works... What is up? (Any errors that would cause the script to end like misplacement of "ends" are because of copy-paste without showing the whole script, even though you all are fully capable of duplicating it, I know) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 21 Mar 2014 02:35 AM |
| I'll repost this in the morning when more are on, g'night. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 02:59 AM |
So apparently the script isn't registering that it is even touching anything.
This is how I figured that out.
(Not touching it) function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(2) untagHumanoid(humanoid) elseif hit.BrickColor == BrickColor.new("Reddish brown") then print'touch' end print'uwotm8' connection:disconnect() end
>No output
(Touching it, died in the process)
>uwotm8
Anything else before I call it a night? |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 03:00 AM |
When the brick was not touching me, it did nothing.
When it was touching me, it killed me. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 03:12 PM |
New day, new bump
Please help me with this, it is not registering a touch event when the brick appears, unless I jump on the brick. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Mar 2014 04:32 PM |
http://www.roblox.com/eventually-making-a-game-out-of-this-place?id=144404994 Exhibit1 is the projectile launcher that works Exhibit2 is the part that spawns a brick around the ball deployed.
These both should in theory remove the brown bricks.
Thanks if you try to help... |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 21 Mar 2014 04:36 PM |
| If the touched event is being glitchy, then you could maybe try something like checking if a block/player is really close to it. Not sure what else to suggest since your code looks sound. :/ |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 04:37 PM |
Good idea, I should try other ways.
Thanks. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 04:51 PM |
| I'll leave the game open for a day, so others can see if they know why it is glitchy. Another way I could try it is make the brick quickly grow, but I am unfamiliar with how. Could someone tell me? |
|
|
| Report Abuse |
|
|