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: What is wrong with this?

Previous Thread :: Next Thread 
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
21 Mar 2014 02:17 AM
b1 pls halp
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
21 Mar 2014 02:32 AM
b2
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
21 Mar 2014 02:35 AM
I'll repost this in the morning when more are on, g'night.
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
21 Mar 2014 04:15 PM
Bump
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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 is not online. 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
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
21 Mar 2014 04:37 PM
Good idea, I should try other ways.

Thanks.
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
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
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