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: Someone hele me make sense of this!

Previous Thread :: Next Thread 
Fliers11 is not online. Fliers11
Joined: 28 Jul 2009
Total Posts: 1188
08 Apr 2012 08:14 PM
Here's an "if" statement:

if hit.Parent ~= script.Parent.avoid.Value or hit.Parent.Parent ~= script.Parent.avoid.Value then

What it does is it checks if ObjectValue "avoid"'s value is equal to the person it touched, no matter if it touched their hat, gear, or person. Problem is, it does not do that whatsoever...it just follows the script as if that part of the script never existed.

There is an ObjectValue in the brick called "avoid", and it is equal to my character.
Report Abuse
Quovis is not online. Quovis
Joined: 24 Mar 2012
Total Posts: 494
08 Apr 2012 08:19 PM
Post the whole script please
Report Abuse
Fliers11 is not online. Fliers11
Joined: 28 Jul 2009
Total Posts: 1188
08 Apr 2012 08:21 PM
Here - it's a script put into a brick created when you activate a tool. Don't worry about the tool, everything else works fine.

ting = 0
function onTouch(hit)
if hit.Parent ~= script.Parent.avoid.Value or hit.Parent.Parent ~= script.Parent.avoid.Value then
if ting == 0 then
ting = 1
cnt = Instance.new("Weld")
cnt.Parent = script.Parent
cnt.Part0 = hit
cnt.Part1 = script.Parent
cnt.C0 = CFrame.new(Vector3.new(script.Parent.Position - hit.Position), hit.Position)
script.Parent.CanCollide = true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if hit.Parent.Name == "Head" then
hit.Parent.Humanoid.Health = 0
else
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - math.random(25, 50)
end
end
wait(10)
cnt:remove()
script.Parent.CanCollide = false
end end end
script.Parent.Touched:connect(onTouch)
Report Abuse
Fliers11 is not online. Fliers11
Joined: 28 Jul 2009
Total Posts: 1188
08 Apr 2012 11:17 PM
bump
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