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's wrong with my script?

Previous Thread :: Next Thread 
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:36 PM
Purpose: Injures specific teams that are displayed based on a value that's a child on that NPC.

Problem: Doesn't damage anyone.

Script:



function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
local myteam = script.Parent.Parent.Parent:WaitForChild("TeamColor").Value
local histeam = hit.Parent:FindFirstChild("TeamColor")

if histeam and histeam:IsA("BrickColorValue") then
if histeam.Value == myteam.Value then
return
else if
2 + 2 == 4 then
human.Health = human.Health - 3
end
end


end
end end


script.Parent.Touched:connect(onTouched)
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:38 PM
:(
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
26 Apr 2014 07:40 PM
You have a bunch of un-needed checking in your script.. and where is this parented, also your explanation of what it's supposed to do didn't match up to anything close to what you gave in the script.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:46 PM
I don't think you understand scripting.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
26 Apr 2014 07:48 PM
If I try to help you, will you also insult me?
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:49 PM
NPC
+TeamColor
+LinkedSword
++Handle
+++DamageScript
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:49 PM
@xxx, No, he wasn't really helping though. Based on what he said he clearly had no understanding of scripting.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:50 PM
And what I said wasn't really an insult :/
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
26 Apr 2014 07:56 PM
1. You don't need a space between else and if, but it will achieve the same flow of execution.

2. I like the excessive checking, it makes the script more difficult to break.

3. Why are you using WaitForChild to fetch the TeamColor?

4. "I don't think you understand scripting." is an explosive insult to a scripter.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
26 Apr 2014 07:57 PM
The problem is here:

local myteam = script.Parent.Parent.Parent:WaitForChild("TeamColor").Value
...
if histeam.Value == myteam.Value then <
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 07:57 PM
But he's not a scripter lol.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
26 Apr 2014 08:00 PM
And darn, that part looked to me like it was correct.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Apr 2014 08:26 PM
Being the one that needs help, I think you're in a bit of a disposition to be insulting the people that do try. Luckily for you, I don't really care what you think about my skills as long as I know how good I am.

You should read this;

http://en.wikipedia.org/wiki/Respect
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
28 Apr 2014 12:14 AM
lol'd
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