|
| 01 Sep 2014 11:03 PM |
I made two simple scripts and I need help turning them into an expert script. So basically I made a run script to where you press down shift to run, I also made a gui/script for stamina but it's not connected. The stamina script/gui is connected to a button that you click once to run and the stamina will slowly go down. Anyways I want to connect these two scripts to where the stamina goes down when you run with shift instead of the button.
Shift run script: wait()local Player=game.Players.LocalPlayer local Mouse = Player:GetMouse() local Speed = 35 local Humanoid = Player.Character:WaitForChild("Humanoid") local OrigSpeed = Humanoid.WalkSpeed
Mouse.KeyDown:connect(function(Key)local Code=Key:byte()if(Code==48)then Humanoid.WalkSpeed = Speed end end) Mouse.KeyUp:connect(function(Key)local Code=Key:byte()if(Code==48)then Humanoid.WalkSpeed = OrigSpeed end end)
Stamina script: run = script.Parent.Running stam = script.Parent.Stamina maxstam = stam.Value frame = script.Parent.Frame bar = frame.Bar runb = script.Parent.Run reset = script.Parent.Reset plr = script.Parent.Parent.Parent usespeed = 5 regainspeed = 5
reset.MouseButton1Click:connect(function(mouse) pcall(function() plr.Character:BreakJoints() end) end)
runb.MouseButton1Click:connect(function(mouse) pcall(function() if run.Value == true then run.Value = false elseif run.Value == false then if stam.Value > 0 then run.Value = true plr.Character.Humanoid.WalkSpeed = 35 else plr.Character.Humanoid.WalkSpeed = 16 end end end) end)
while true do wait() if run.Value == true then plr.Character.Humanoid.WalkSpeed = 35 if stam.Value <= 0 then run.Value = false end stam.Value = stam.Value - maxstam/(usespeed*200) bar.Size = bar.Size - UDim2.new(1/(usespeed*200),0,0,0) elseif run.Value == false then if stam.Value < maxstam then plr.Character.Humanoid.WalkSpeed = 16 stam.Value = stam.Value + maxstam/(regainspeed*200) bar.Size = bar.Size + UDim2.new(1/(regainspeed*200),0,0,0) end end end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Subete
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 917 |
|
|
| 01 Sep 2014 11:06 PM |
if he could script that but doesn't know how to connect them
100% free model
but i dont judge |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2014 11:10 PM |
| Those are simple scripts.. Even a toddler could write them, how are they free models? Go ahead and try to find the exact same script. Anyways combining them is a hard process |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 01 Sep 2014 11:48 PM |
Well. If you know how to script that. You could do it.
If it's freemodels just say it. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2014 11:52 PM |
| I always say when I use free models (Credit the owner) Combining these scripts is just difficult for me, apparently you people find it weird that I can script those scripts but I cant combine them but I think that's perfectly normal for a intermediate scripter |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2014 12:03 AM |
Because I cant combine them*
|
|
|
| Report Abuse |
|
|
|
| 02 Sep 2014 03:39 AM |
.-.
this is what I did
running/refill ------
wait(1)
on = false
plr = game.Players.LocalPlayer cam = game.Workspace.CurrentCamera arm1 = plr.Character.Torso["Right Shoulder"] arm2 = plr.Character.Torso["Left Shoulder"]
m = plr:GetMouse()
m.KeyDown:connect(function(key) if not on then if key:lower() == "q" then if plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value >=20 then if not on then on = true plr.Character.Humanoid.WalkSpeed = 30 plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value = plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value - 20 wait(4) plr.Character.Humanoid.WalkSpeed = 16 wait(1) on = false end end end end end)
function lol() for i = 1,math.floor(plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value/4,.5) do wait(0) if plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value ~= plr.PlayerGui.Bars.Stamina.Frame.LocalScript.CORN.Value then plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value = plr.PlayerGui.Bars.Stamina.Frame.LocalScript.POP.Value + 1 else end end end
while wait(10) do lol() end
--stamina--
wait(0)
val = script.POP maxval = script.CORN
while true do wait(0.1) local pie = ( val.Value / (maxval.Value)) script.Parent.Size = UDim2.new( pie , 0 , 0, 20) end |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2014 03:41 AM |
| Stamina/Health/Exp, etc. bars are easy to make btw.. |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2014 11:33 AM |
| Yeah I can work on thos myself, thanks thought :) |
|
|
| Report Abuse |
|
|