|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 02 Jan 2016 10:47 AM |
help ;-;
Is this a signature? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|