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 Needed

Previous Thread :: Next Thread 
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 05:43 PM
I already made a thread on this, but the information was jumbled around and got confusing for more people to help.

Alright, so, I have been off of ROBLOX for almost a year now thanks to being busy and everything, and when I got back, some people informed me of some tools breaking in my game after the recent ROBLOX update.

Here is a little bit about the tool. What it does is place out bricks that deal damage when walked through. Now, my issue is that they are not doing the damage they are supposed to do. It's just placing out bricks to walk through but not dealing damage.

Here is the script that places the brick out that will do the damage:

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
brick.Size = Vector3.new(3,3,3)
brick.BrickColor = BrickColor.new("Really red")
brick.CanCollide = false
brick.Transparency = 0.2
brick.Anchored = true
script.Parent.Mesh:clone().Parent = brick

enabled = true



function onButton1Down(mouse)
local player = game.Players.LocalPlayer
if player == nil then return end
print("trigger")
-- find the best cf

spew = true
while spew do
wait(.05)
newbrick = brick:clone()
newbrick.Position = mouse.Hit.p
script.Parent.lorva:clone().Parent = newbrick
game.Lighting.Remive:clone().Parent = newbrick
newbrick.Parent = game.Workspace
player.PlayerGui.Chakra.Clock.Value = player.PlayerGui.Chakra.Clock.Value - 1
end
end

function onButton1Up(mouse)
spew = false
end

function onSelected(mouse)
print("select")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

bin.Selected:connect(onSelected)

This is the script that is put inside of the brick placed by the above script to deal damage:

print("Unanchor Loaded")

LandMine = script.Parent

function onTouched(hit)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1.5
end

connection = LandMine.Touched:connect(onTouched)

I suspect it is the second script that is broke, since the only issue is it won't deal the damage. Any ideas?
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 05:53 PM
A friend told me that someone who fixed it said it was the .Touched section that was giving the biggest problem. (On the second script.)
Report Abuse
Shikigami is not online. Shikigami
Joined: 24 Jan 2012
Total Posts: 17
12 Aug 2012 05:54 PM
function onTouched(part)
local Damage = part.Parent:findFirstChild("Humanoid")
if Damage~=nil then
Damage.Health = Damage.Health - 1.5
wait(0)
end
end

script.Parent.Touched:connect(onTouched)



--That should be somewhat more clean than what you have. Your connection line is wrong. You dont need [connection =]

--Rikuren
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 06:03 PM
When I applied the changes, the tool worked as should, except it still did no damage. :S
Report Abuse
Shikigami is not online. Shikigami
Joined: 24 Jan 2012
Total Posts: 17
12 Aug 2012 06:04 PM
Clone this into the brick that does damage




function onTouched(part)
local Damage = part.Parent:findFirstChild("Humanoid")
if Damage~=nil then
Damage.Health = Damage.Health - 1.5
wait(0)
end
end

script.Parent.Touched:connect(onTouched)





--If all else fails, go read the output to see what's wrong

--Rikuren
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 07:01 PM
That didn't work either.

:\
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 07:08 PM
Alright, looked at the output.


Touched is not a valid member of HopperBin.



So, does that help? Anyone? D:
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
12 Aug 2012 07:17 PM
So, how do I remove Touched and yet keep the same function going?
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
13 Aug 2012 08:41 AM
I was just told by Mastrj that OnTouched() broke. :o How do I fix it? >_<
Report Abuse
general75 is not online. general75
Joined: 25 Sep 2008
Total Posts: 21
13 Aug 2012 09:25 AM
sry if incorrect a little rusty on my scripting

function onTouched()
local victom = game.Workspace:FindFirstChild("Humanoid")

if(victom ~= nil) then
victom.Health = -1.5
end
end

victom.Touched:connect(onTouched)
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
13 Aug 2012 09:55 AM
You mean victim? :o
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
13 Aug 2012 10:17 AM
It is a variable, makes no different at all.
Report Abuse
Romul is not online. Romul
Joined: 08 Mar 2009
Total Posts: 597
13 Aug 2012 02:05 PM
Still no worky..
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