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: Will this work?

Previous Thread :: Next Thread 
uknowdudes is not online. uknowdudes
Joined: 10 Jan 2011
Total Posts: 993
02 Jan 2016 10:43 AM
So im making a script that whenever you touch the baseplate, you go slow and your xp increases
I just made this straight out of imagination

jun = script.Parent.Parent
humanoid = hit.Parent
Workspace.Part.Touched:connect(function(otherPart)
function OnPlayerTouched
if humanoid then
huamnoid.WalkSpeed = 14
end

now i don't know what to do on how i get the leaderstats and everything so please help




Is this a signature?
Report Abuse
uknowdudes is not online. uknowdudes
Joined: 10 Jan 2011
Total Posts: 993
02 Jan 2016 10:44 AM
bump

Is this a signature?
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
02 Jan 2016 10:47 AM
Nope, this wouldn't work.

1) There's no Touched function before you actually connect it so the humanoid variable is equal to nil.
2) You don't need "function OnPlayerTouched" nor is that how you would even make a function. So, the script would definitely error.
3) As stated before, humanoid is equal to nil so even if it managed to reach that if statement, which it won't, humanoid would be equal to false/nil so it wouldn't continue.
4) "huamnoid" wasn't defined anywhere.
5) You're missing an end.)
Report Abuse
uknowdudes is not online. uknowdudes
Joined: 10 Jan 2011
Total Posts: 993
02 Jan 2016 10:47 AM
help ;-;

Is this a signature?
Report Abuse
uknowdudes is not online. uknowdudes
Joined: 10 Jan 2011
Total Posts: 993
02 Jan 2016 10:52 AM
What about this

function onTouch(hit)
if hit.Parent.Name == "Humanoid" then
????
???
end
script.Parent.Touched:connect(onTouch)

Is this a signature?
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
02 Jan 2016 10:55 AM
That wouldn't work either.

1) The parent of the part that touches something definitely won't be the humanoid so the script would stop as the script would return false.
2) You're missing an end, again.

function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") then
-- code here
end
end

script.Parent.Touched:connect(onTouch)
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