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
 

Why won't this work

Previous Thread :: Next Thread 
MechaGodziIIa is not online. MechaGodziIIa
Joined: 25 Apr 2009
Total Posts: 26938
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 is not online. 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
MechaGodziIIa is not online. MechaGodziIIa
Joined: 25 Apr 2009
Total Posts: 26938
04 Nov 2014 04:20 PM
bump
Report Abuse
Discern is not online. 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
MechaGodziIIa is not online. MechaGodziIIa
Joined: 25 Apr 2009
Total Posts: 26938
04 Nov 2014 04:22 PM
trying it
Report Abuse
Discern is not online. 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
MechaGodziIIa is not online. MechaGodziIIa
Joined: 25 Apr 2009
Total Posts: 26938
04 Nov 2014 04:25 PM
HOLY
THANK U SO MUCH <3
Report Abuse
Discern is not online. 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
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