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: Can someone tell me what's wrong with this script?

Previous Thread :: Next Thread 
koke15 is not online. koke15
Joined: 29 Sep 2010
Total Posts: 3909
13 Aug 2014 10:31 PM
It's my first ever script I made and it is supposed to give the played 99999 Wipeouts, but it only gives one, then stops working.


function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then -- if a humanoid exists, then
humanoid.Health = 0 -- damage the humanoid
player.leaderstats.Wipeouts.Value = 99999
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
13 Aug 2014 10:36 PM
l0l
Report Abuse
koke15 is not online. koke15
Joined: 29 Sep 2010
Total Posts: 3909
13 Aug 2014 10:38 PM
aAAA I AM NEW TO THE LUA WORLD
Report Abuse
Cetharis is not online. Cetharis
Joined: 27 Jul 2012
Total Posts: 25
13 Aug 2014 11:14 PM


player is not defined.

if it's a local script than you can use

player=game.Players.LocalPlayer

player.leaderstats.Wipeouts.Value = 99999
Report Abuse
koke15 is not online. koke15
Joined: 29 Sep 2010
Total Posts: 3909
13 Aug 2014 11:19 PM
THANK YOU SO MUCH
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:21 PM
dont listen to that bozo.
That won't work online but gg anyways
You need to get the player from the character that TOUCHED it



function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) and game:GetService("Players"):GetPlayerFromCharacter(part.Parent) then -- if a humanoid exists, then
local player=game:GetService("Players"):FindFirstChild(part.Parent.Name)
humanoid.Health = 0 -- damage the humanoid
player.leaderstats.Wipeouts.Value = 99999
end
end
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:21 PM
forgot to put the connection line as I was just correcting a function.
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:22 PM
eww why did you say game:GetServive'Players'
just say game.Players:GetPlayerFromCharacter(hit.Parent)

http://www.roblox.com/--item?id=171600495
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:23 PM
Because I do, deal with it.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:26 PM
And by the way, I used parenthesis and double quotes. Also it's part, not hit. Too used to editing free models, eh?
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:26 PM
No, I have NEVER seen that before and I didn't remember the exact format.

http://www.roblox.com/--item?id=171600495
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:27 PM
I never use free models, it is morally wrong.

http://www.roblox.com/--item?id=171600495
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:29 PM
And I said hit because that is what I use to represent the part that hit the block when I make similar scripts.

http://www.roblox.com/--item?id=171600495
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:29 PM
It isn't morally wrong, people learn that way. And, if you didn't know GetService will return Players even if Players isn't named Players. Whereas you are just indexing "Players" straight up.
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:30 PM
Renaming Players is just stupid, so if you are dumb enough to do that, than you deserve your script to malfunction.

http://www.roblox.com/--item?id=171600495
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:30 PM
Who said you are doing it? How about an exploiter?
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:31 PM
then*

http://www.roblox.com/--item?id=171600495
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:32 PM
Why would an exploiter take the time to rename Players?

http://www.roblox.com/--item?id=171600495
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:35 PM
So he can't be indexed.
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
13 Aug 2014 11:38 PM
You have a point there. But for a script like this? It's a waste of time to type that.

http://www.roblox.com/--item?id=171600495
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 11:38 PM
tru tru
Report Abuse
koke15 is not online. koke15
Joined: 29 Sep 2010
Total Posts: 3909
14 Aug 2014 09:46 PM
Thanks a lot guys
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