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 » Scripters
Home Search
 

Re: Chunk of script doesn't work?

Previous Thread :: Next Thread 
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
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 is not online. 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 is not online. 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
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 12:49 AM
Welp, that didnt work.
Report Abuse
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
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 is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
17 Aug 2016 12:50 AM
Did the print show up?


Report Abuse
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 12:52 AM
Nada.
Report Abuse
OldGoldie is not online. 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 is not online. 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
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 05:33 PM
ugh..nothing works.
Report Abuse
JohnnyThunder2 is not online. JohnnyThunder2
Joined: 11 Apr 2009
Total Posts: 1043
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 is not online. 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
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
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 is not online. sonihi
Joined: 27 Jun 2009
Total Posts: 3655
17 Aug 2016 06:18 PM
Justin what this supposed to do?
Report Abuse
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
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
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 06:23 PM
u didnt call the function @justin
Report Abuse
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
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
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 06:34 PM
bump
Report Abuse
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
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
aIternatlveaccount is not online. aIternatlveaccount
Joined: 21 Feb 2016
Total Posts: 295
17 Aug 2016 06:35 PM
id rather do it myself
like a self task
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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