How To Make Rapid Speed up Buttons: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker
No edit summary
>Flurite
 
(10 intermediate revisions by 5 users not shown)
Line 2: Line 2:
==Introduction==
==Introduction==


WalkSpeed is what it sounds like, the speed at which your character walks. Go into solo mode in [[Roblox Studio]] and select yourself. If you look at your [[Humanoid]], you will notice in the [[Properties|Properties panel]] a new value entitled "WalkSpeed" set to a default value of 16.  The higher this value, the faster. Negative Values cause your controls to reverse.
The WalkSpeed property is what controls the speed of movement of your character. If you look at your [[Humanoid]], you will notice in the [[Properties|Properties panel]] a new value entitled "WalkSpeed" set to a default value of 16.  The higher this value, the faster. Negative Values cause your controls to reverse.


== Steps ==
== Steps ==


* Insert a brick of any color and shape.<br>
# Insert a brick of any color and shape.<br>
* Insert / Object / Script into that brick.<br>
# Insert / Object / Script into that brick.<br>
* Insert the following script into that brick:<br>
# Insert the following script into that brick:<br>


== Script ==
== Script ==


<pre>
<pre>
function onTouched(part)
function onTouched(part) -- the function
     if part.Parent ~= nil then
     if part.Parent then -- make sure the toucher has a parent
    local h = part.Parent:findFirstChild("Humanoid")
          local h = part.Parent:findFirstChild("Humanoid")
           if h~=nil then
           if h then -- checks to see that it was a character that touched it
          h.WalkSpeed = 80 -- go five times faster than default speed.
              h.WalkSpeed = 80 -- go five times faster than default speed (16).
           end
           end
     end
     end
end
end
script.Parent.Touched:connect(onTouched)  
script.Parent.Touched:connect(onTouched) -- connect the function to the event
</pre>
</pre>


Now test the script in Tools / Test / Play Solo mode.  When your character walks over the brick, it should suddenly speed up.
Now test the script in Tools / Test / Play Solo mode.  When your character walks over the brick, it should suddenly speed up.

Latest revision as of 22:33, 16 September 2011

Introduction

The WalkSpeed property is what controls the speed of movement of your character. If you look at your Humanoid, you will notice in the Properties panel a new value entitled "WalkSpeed" set to a default value of 16. The higher this value, the faster. Negative Values cause your controls to reverse.

Steps

  1. Insert a brick of any color and shape.
  2. Insert / Object / Script into that brick.
  3. Insert the following script into that brick:

Script

function onTouched(part) -- the function
     if part.Parent then -- make sure the toucher has a parent
          local h = part.Parent:findFirstChild("Humanoid")
          if h then -- checks to see that it was a character that touched it
               h.WalkSpeed = 80 -- go five times faster than default speed (16).
          end			
     end
end
script.Parent.Touched:connect(onTouched) -- connect the function to the event

Now test the script in Tools / Test / Play Solo mode. When your character walks over the brick, it should suddenly speed up.