|
| 04 Nov 2014 04:14 PM |
What I want it to do:
Tool that makes you go fast when you click, but it doesn't make you fast if the tool's name is changed to "Decaf Coffee". The first portion works, but the other portion doesn't. Read the script below and please help me fix it, I'm fairly new to lua.
--Variables local Tool = script.Parent; local name = Tool.Name
--Functions function onActivated() local h = Tool.Parent:FindFirstChild("Humanoid") if (h ~= nil) then h.WalkSpeed = 32
-- THE TOP PORTION WORKS, BUT THE BOTTOM DOESNT --
else if name == ("Decaf Coffee") then h.Walkspeed = 16 end end end script.Parent.Activated:connect(onActivated)
--MechaGodziIIa-- |
|
|
| Report Abuse |
|
|
Discern
|
  |
| Joined: 02 Feb 2013 |
| Total Posts: 331 |
|
|
| 04 Nov 2014 04:20 PM |
--Variables local Tool = script.Parent; local name = Tool.Name
--Functions function onActivated() local h = Tool.Parent:FindFirstChild("Humanoid") if h and Tool.Name ~= "Decaf Coffee" then h.WalkSpeed = 32 elseif h and Tool.Name == "Decaf Coffee" then h.Walkspeed = 16 end end script.Parent.Activated:connect(onActivated) |
|
|
| Report Abuse |
|
|
| |
|
Discern
|
  |
| Joined: 02 Feb 2013 |
| Total Posts: 331 |
|
|
| 04 Nov 2014 04:21 PM |
did it work
-[=[Discern || Inferno Order Soldier || Graphics Designer || Trader || Game Developer || Clan Man]=]- discernrblx.deviantart.com |
|
|
| Report Abuse |
|
|
| |
|
Discern
|
  |
| Joined: 02 Feb 2013 |
| Total Posts: 331 |
|
|
| 04 Nov 2014 04:24 PM |
owait in line 11 change "Walkspeed" to "WalkSpeed" cuz caps matter
-[=[Discern || Inferno Order Soldier || Graphics Designer || Trader || Game Developer || Clan Man]=]- discernrblx.deviantart.com |
|
|
| Report Abuse |
|
|
| |
|
Discern
|
  |
| Joined: 02 Feb 2013 |
| Total Posts: 331 |
|
|
| 04 Nov 2014 04:25 PM |
np
-[=[Discern || Inferno Order Soldier || Graphics Designer || Trader || Game Developer || Clan Man]=]- discernrblx.deviantart.com |
|
|
| Report Abuse |
|
|