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
 

Re: Running Tool

Previous Thread :: Next Thread 
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Apr 2014 10:51 PM
I have a tool that allows you to insert a desired speed in a GUI. When you wish to go that speed, you have to double click 'w'. It doesn't do anything. No output.

-- Cizox

r = game:GetService('RunService')
bin = script.Parent

player = script.Parent.Parent.Parent
humanoid = player.Character.Humanoid
runGUI = nil

while true do
wait()
if player.Character then
if player.Character:FindFirstChild("Torso") and player.Character:FindFirstChild("Humanoid") then break end
end
end

coroutine.resume(coroutine.create(function()
while true do
wait(0.2)
if player.Character.Humanoid.WalkSpeed > 16 then
if player.Character.Torso.Velocity.magnitude < 1 then
player.Character.Humanoid.WalkSpeed = 16
end
end
end
end))

script.Parent.Selected:connect(function(mouse)
runGUI = script.Parent:FindFirstChild("RunGui"):Clone()
runGUI.Parent = player.PlayerGui
runGUI.RunFrame.Enter.MouseButton1Click:connect(function()
mouse.KeyDown:connect(function(key)
key = key:lower()
t = r.Stepped:wait()
click = 0
lastKey = ''
if (t - click < .2) and (key == lastKey) then
if key:match('w') then
humanoid.WalkSpeed = tonumber(runGUI.RunFrame.RunSpeed.Text) or 16
end
end
end)
click = t
lastKey = key
end)
end)

script.Parent.Deselected:connect(function()
local runGui = Player.PlayerGui:FindFirstChild('RunGui')
if runGui then
runGui:Destroy()
end
humanoid.WalkSpeed = 16
end)
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
07 Apr 2014 10:53 PM
somthing about running tool, leads me hobberbin, they only work in localscripts now. as in make the script local (i think ur talking about that)
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Apr 2014 10:55 PM
It's in a LocalScript, still doesn't work.
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
07 Apr 2014 10:56 PM
Hmm yes that code isnt fit for localscript then (or they broke hoppergins AGAIN! >:D) (stupid updates)


--When life give's you lemo's.. BURN HIS HOUSE DOWN >:D--
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Apr 2014 10:57 PM
They still work. I tried this with an earlier version and it works. The only thing I added here is the ability to double tap w.
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Apr 2014 11:10 PM
Bump.
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
07 Apr 2014 11:14 PM
find a way to do this or something..

while toolisselected do
gui
run
end?
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
07 Apr 2014 11:36 PM
Bump.
Report Abuse
Vexeris is not online. Vexeris
Joined: 03 Apr 2014
Total Posts: 468
07 Apr 2014 11:39 PM
u never changed the speed lol
Report Abuse
Swoof is not online. Swoof
Joined: 13 Mar 2010
Total Posts: 16146
08 Apr 2014 12:03 AM
@vex didnt he change it rite here

if key:match('w') then
humanoid.WalkSpeed = tonumber(runGUI.RunFrame.RunSpeed.Text) or 16
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
08 Apr 2014 12:06 AM
"humanoid.WalkSpeed = tonumber(runGUI.RunFrame.RunSpeed.Text)"
Report Abuse
Vexeris is not online. Vexeris
Joined: 03 Apr 2014
Total Posts: 468
08 Apr 2014 12:10 AM
theres ur error lol
Report Abuse
Cizox is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
08 Apr 2014 09:18 PM
What might be a solution to it?
Report Abuse
Vexeris is not online. Vexeris
Joined: 03 Apr 2014
Total Posts: 468
08 Apr 2014 09:22 PM
r = game:GetService('RunService')
bin = script.Parent

player = script.Parent.Parent.Parent
humanoid = player.Character.Humanoid
runGUI = nil

while true do
wait()
if player.Character then
if player.Character:FindFirstChild("Torso") and player.Character:FindFirstChild("Humanoid") then break end
end
end

coroutine.resume(coroutine.create(function()
while true do
wait(0.2)
if player.Character.Humanoid.WalkSpeed > 16 then
if player.Character.Torso.Velocity.magnitude < 1 then
player.Character.Humanoid.WalkSpeed = 16 <---- increase the speed here
end
end
end
end))

script.Parent.Selected:connect(function(mouse)
runGUI = script.Parent:FindFirstChild("RunGui"):Clone()
runGUI.Parent = player.PlayerGui
runGUI.RunFrame.Enter.MouseButton1Click:connect(function()
mouse.KeyDown:connect(function(key)
key = key:lower()
t = r.Stepped:wait()
click = 0
lastKey = ''
if (t - click < .2) and (key == lastKey) then
if key:match('w') then
humanoid.WalkSpeed = tonumber(runGUI.RunFrame.RunSpeed.Text) or 16
end
end
end)
click = t
lastKey = key
end)
end)

script.Parent.Deselected:connect(function()
local runGui = Player.PlayerGui:FindFirstChild('RunGui')
if runGui then
runGui:Destroy()
end
humanoid.WalkSpeed = 16
end)
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
08 Apr 2014 09:23 PM
No need for tonumber

Because simply, if it is not a number, the script will NOT error, but walkspeed will be set to 0
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
08 Apr 2014 09:25 PM
z = key:lower() == "z"
plr = game.Players.LocalPlayer
if plr.z then
plr.Character.Humanoid.Walkspeed = 22
else
plr.Character.Humanoid.Walkspeed = 16
end
-- I think
Report Abuse
Poseidas is not online. Poseidas
Joined: 23 Nov 2008
Total Posts: 2659
08 Apr 2014 09:46 PM
@Blade - No.

Anyway...

local lastClickW = 1

player:GetMouse().KeyDown:connect(function()
if key:lower() == "w" then
local upd = lastClickW
local lastClickW = tick()
if (tick()-upd) <= .3 then
--Doubleclick stuff
else
--Normal stuff
end
end
end)

~ "It's better to light a candle than to curse the dark" - K'naan
Report Abuse
Poseidas is not online. Poseidas
Joined: 23 Nov 2008
Total Posts: 2659
08 Apr 2014 09:47 PM
Correction, make lastClickW = 0.

~ "It's better to light a candle than to curse the dark" - K'naan
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