|
| 17 Aug 2016 12:40 AM |
function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil) then hit.Parent.Humanoid:TakeDamage(25) hit.Parent.Humanoid.Jump = true end end
bolt.Touched:connect(onTouched)
Should do dmg and jump them but it's not working. |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 17 Aug 2016 12:44 AM |
function onTouched(hit) player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then hit.Parent.Humanoid:TakeDamage(25) hit.Parent.Humanoid.Jump = true end end Try this. I like using this when verifying if it's a player
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 17 Aug 2016 12:44 AM |
If that doesn't work, try print at the very top of the function to make sure that the touched function works?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Aug 2016 12:50 AM |
Huh, odd, the print doesn't work. Oh well, here's the important part hold = false mouse.Button1Down:connect(function() hold = true while hold == true do local from = workspace.Part1.Position local too = Vector3.new(mouse.hit.x,mouse.hit.y,mouse.hit.z) function onTouched(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) if player then hit.Parent.Humanoid:TakeDamage(25) hit.Parent.Humanoid.Jump = true end print('test') end ShootElectrode(from,too) wait() end
end) mouse.Button1Up:connect(function() hold = false end) |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
| |
|
| |
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 17 Aug 2016 12:55 AM |
That probably means the bullet going too fast. If not, then I'm not sure
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 17 Aug 2016 12:56 AM |
Oh there's this function onTouched(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) if player then
Should be if plr then or player = thestufff
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Aug 2016 05:50 PM |
| But haven't you got a while loop running before it can connect the Touched function? |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 17 Aug 2016 05:57 PM |
Post ALL of your script, or go into "View" and then activate the output and send anything that is red followed by what is blue. But I think you may already have done that. |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2016 06:17 PM |
hold = false local Connections = {} table.insert(Connections, mouse.Button1Down:connect(function() hold = true while hold == true do local from = workspace.Part1.Position local too = Vector3.new(mouse.hit.x,mouse.hit.y,mouse.hit.z) function onTouched(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) if player then hit.Parent.Humanoid:TakeDamage(25) hit.Parent.Humanoid.Jump = true end print('test') end ShootElectrode(from,too) wait() end end))
table.insert(Connections, mouse.Button1Up:connect(function() hold = false end))
|
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 17 Aug 2016 06:18 PM |
| Justin what this supposed to do? |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2016 06:21 PM |
I don't know but that would fix his problem. He was trying to run a connection that wasn't being defined because the while loop would constantly circle before going lower into the script.
|
|
|
| Report Abuse |
|
|
|
| 17 Aug 2016 06:23 PM |
| u didnt call the function @justin |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2016 06:24 PM |
Oh I just noticed you had that in there! Let me fix that for you real quick.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Aug 2016 06:34 PM |
One question, what is the point of this? I'm trying to figure out what the heck this is for but its so inefficient and I can't really optimize something so horrible written. Tell me what you need done so I can do it for you.
|
|
|
| Report Abuse |
|
|
|
| 17 Aug 2016 06:35 PM |
id rather do it myself like a self task |
|
|
| Report Abuse |
|
|