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 » Club Houses » Clans & Guilds
Home Search
 

Re: @C&G Scripters 2

Previous Thread :: Next Thread 
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 12:51 AM
Alright, so I have an unanchored bricks that are welded together that like to move around. Specically, a giant chain.

I want to have one script get all the parts in a model that are labeled "Kill" to kill any player that touches the brick.


I'm having trouble getting all the parts.


I've been moving stuff around in attempts to fix it.


prntscr /4bc0pa

--function onTouched(hit)
for i,v in ipairs()(script.Parent:GetChildren()) do wait()
if hit.Parent.Name == v.Name then
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent ~= nil then
player.Humanoid.Health = 0
end
end
end
end
end

-- script.Parent.Touched:connect(onTouched)
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 12:53 AM
am in need of help
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 12:54 AM
Have you ever considered hooking up the Touched event onto the parts of a Character and checking for parts named "Kill" that touch them, rather than hooking up events to the "Kill" parts and verifying if the character is actually a player's character, then checking for humanoid, then doing the damage?

It's a lot less convoluted if you do it my way.

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:01 AM
I wrote up a server-side example dealing 20 damage with a 1 second debounce...


local Create = LoadLibrary("RbxUtility").Create

local function characterAdded(character)
local player = game.Players:GetPlayerFromCharacter(character)

if player ~= nil then
local humanoid = character:WaitForChild("Humanoid")

local function hookUpTouchDamage(object)
local tagFound = humanoid:FindFirstChild("damageTag")
if object:IsA("BasePart") and object.Name == "Kill" and tagFound == nil then
game.Debris:AddItem(Create("BoolValue")({Parent = humanoid}), 1)
humanoid.Health = humanoid.Health - 20 > 0 and humanoid.Health - 20 or 0
end
end

character.ChildAdded:connect(function(object)
if object:IsA("BasePart") then
object.Touched:connect(hookUpTouchDamage)
end
end)

for _, object in pairs(character:GetChildren()) do
if object:IsA("BasePart") then
object.Touched:connect(hookUpTouchDamage)
end
end

end
end

workspace.ChildAdded:connect(characterAdded)
Report Abuse
Ghosty2Spooks is not online. Ghosty2Spooks
Joined: 04 Dec 2010
Total Posts: 20644
10 Aug 2014 01:02 AM
damn unclear i dont know what you just said but it turned me on
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:03 AM
Examples please?


I sort of understand what you're saying but at the same time I probably don't.

So you're saying instead of checking for parts that are named "Kill" first and then checking if the character is a character and doing the damage,

check for the parts of the character that are touching the "Kill" parts?
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:04 AM
o you already posted example e.e
Report Abuse
thea96 is not online. thea96
Joined: 09 Feb 2011
Total Posts: 37634
10 Aug 2014 01:04 AM
quick question


do UnionOperations now count as baseparts?
Report Abuse
Blockbuilder1234 is not online. Blockbuilder1234
Joined: 31 Jan 2009
Total Posts: 6239
10 Aug 2014 01:05 AM
lol'd @Ghosty2Spooks
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:06 AM
Just noticed that I messed up the debounce because I forgot to assign a name to the tag. Replace the relevant line with

game.Debris:AddItem(Create("BoolValue")({Parent = humanoid, Name = "damageTag"}), 1)

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:06 AM
@thea96

Yes, a UnionOperation's superclass is BasePart.

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:08 AM
see i'm trying to learn this stuff but i'm so far behind its not even funny


currently just working off other people's examples/help and trying to make them better/refine them/fix them

how long have you guys been doing this for
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:09 AM
I would say that I became a "competent" scripter six months ago when I decided to relearn Lua.

You know I wasn't that good before then because I was one of the developers for 7G, and even then I was just an apprentice.

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:11 AM
what exactly did you specifically do to become a "competent scripter"

you and thea manage to figure it all out in like half a year
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:11 AM
like did you write down Lua terms/functions on flash cards and memorize them

then test each function out and try and make an approach for it?
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:12 AM
The only thing you need to do is practice. Studying is a waste of time.

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Spacetoad is not online. Spacetoad
Joined: 11 Nov 2011
Total Posts: 4539
10 Aug 2014 01:13 AM
unclear i will hurt your mind


script(off)delete
end
end
Report Abuse
thea96 is not online. thea96
Joined: 09 Feb 2011
Total Posts: 37634
10 Aug 2014 01:14 AM
just read free models and read up on the wiki when you need to

start making your own simple scripts like bricks that kill when touched or team changing bricks
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:15 AM
Don't even bother reading other people's code. I can't even read code other people write; I can only read my own code.

~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Warzynski is not online. Warzynski
Joined: 21 Nov 2010
Total Posts: 7721
10 Aug 2014 01:17 AM
Thanks for the help.

So best ways to practice?


Like how small did you start, or what was the first thing you made when you tried practicing?
Report Abuse
Unclear is not online. Unclear
Joined: 27 Aug 2011
Total Posts: 17060
10 Aug 2014 01:19 AM
I learned how to script to take on the 7G project which ColourTheory asked me to do.


The third revision of 7G was the first thing I ever scripted.


Basically I don't waste my time on small projects. I only do big ones, and I do them alone without help from anyone else.


~~ tu tu tu tu tu tu ru ♪♪
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Club Houses » Clans & Guilds
   
 
   
  • 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