|
| 02 Jul 2016 01:55 AM |
Im tryna make tweening stop while it is in the middle of tweening and it is not going well... Any Suggestions?I labeled the script for all the things that suppose to Stop and start the tweening...
player = game.Players.LocalPlayer shot = false barmove = false ---|Tween|---
function key1(key) if (key=='e') then local Meter = Instance.new("ScreenGui", player.PlayerGui) Meter.Name = 'ShotMeter' --|Background|--
local BG = Instance.new("Frame", Meter) BG.Size = UDim2.new(0.01, 0, 0.3, 0) BG.Position = UDim2.new(.15, 0 , .5, 0) BG.BackgroundTransparency = .5
--|Bar|--
local Bar = Instance.new("Frame", BG) Bar.Size = UDim2.new(1,0,0.05,0) Bar.Position = UDim2.new(0, 0, 1, 0) Bar.BackgroundColor3 = Color3.new(0,170,0)
---|Stop|---
local GreenLight = Instance.new("Frame", BG) GreenLight.BackgroundColor3 = Color3.new(173,173,173) GreenLight.BackgroundTransparency = .5 GreenLight.Position = UDim2.new(0,0,.2,0) GreenLight.Size = UDim2.new(1, 0, 0.05, 0)
barmove = true ---|Tween|---
--|variable|--
local speed = .4
while wait() do if barmove == true then ---|Tween|--- Bar:TweenPosition(UDim2.new(0, 0, 0, 0) , "In", "Quad", speed) shot = true end end end end
function Key3(key) if (key=="e") then wait() repeat wait() until shot == true barmove = false ---|Tween|--- script.Parent.Parent = game.Workspace wait() local targetPos=Vector3.new(-110.87, 21.887, 57.45) local bodyp = Instance.new("BodyPosition", script.Parent.Handle) bodyp.maxForce = Vector3.new(2000,2200,2000) bodyp.D = 100 bodyp.P = 250 bodyp.position = targetPos print 'Shot' shot = false wait(1) bodyp:Destroy() player.PlayerGui.ShotMeter:Destroy() end end
function selected(mouse) mouse.KeyUp:connect(Key3) mouse.KeyDown:connect(key1) end
script.Parent.Equipped:connect(selected) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 02 Jul 2016 02:22 AM |
there is a property for tweening that will allow it to be interrupted:
bool TweenPosition ( UDim2 endPosition, EasingDirection easingDirection = Out, EasingStyle easingStyle = Quad, float time = 1, bool override = false, -- this allows it to be interrupted if it's true function(TweenStatus) callback = nil ) |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 02:25 AM |
| Do I look like I know how to read wiki bs |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 02:35 AM |
player = game.Players.LocalPlayer shot = false barmove = false speed = .4
function key1(key) if (key=='e') then local Meter = Instance.new("ScreenGui", player.PlayerGui) Meter.Name = 'ShotMeter' --|Background|--
local BG = Instance.new("Frame", Meter) BG.Size = UDim2.new(0.01, 0, 0.3, 0) BG.Position = UDim2.new(.15, 0 , .5, 0) BG.BackgroundTransparency = .5
--|Bar|--
Bar = Instance.new("Frame", BG) Bar.Size = UDim2.new(1,0,0.05,0) Bar.Position = UDim2.new(0, 0, 1, 0) Bar.BackgroundColor3 = Color3.new(0,170,0)
---|Stop|---
local GreenLight = Instance.new("Frame", BG) GreenLight.BackgroundColor3 = Color3.new(173,173,173) GreenLight.BackgroundTransparency = .5 GreenLight.Position = UDim2.new(0,0,.2,0) GreenLight.Size = UDim2.new(1, 0, 0.05, 0)
barmove = true
--|variable|--
while wait() do if barmove == true then Bar:TweenPosition(UDim2.new(0, 0, 0, 0) , "In", "Quad", speed, true) shot = true end end end end
function Key3(key) if (key=="e") then wait() repeat wait() until shot == true barmove = false Bar:TweenPosition(UDim2.new(0, 0, 0, 0) , "In", "Quad", speed, false) script.Parent.Parent = game.Workspace wait() local targetPos=Vector3.new(-110.87, 21.887, 57.45) local bodyp = Instance.new("BodyPosition", script.Parent.Handle) bodyp.maxForce = Vector3.new(2000,2200,2000) bodyp.D = 100 bodyp.P = 250 bodyp.position = targetPos print 'Shot' shot = false wait(1) bodyp:Destroy() player.PlayerGui.ShotMeter:Destroy() end end
function selected(mouse) mouse.KeyUp:connect(Key3) mouse.KeyDown:connect(key1) end
script.Parent.Equipped:connect(selected) |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 02:37 AM |
literally change this one line:
Bar:TweenPosition(UDim2.new(0, 0, 0, 0) , "In", "Quad", speed, false)
to
Bar:TweenPosition(UDim2.new(0, 0, 0, 0) , "In", "Quad", speed, true) |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 02:46 AM |
| That just stops it fir a sec then keeps tweening it |
|
|
| Report Abuse |
|
|
0Dan
|
  |
| Joined: 22 Oct 2009 |
| Total Posts: 2552 |
|
|
| 02 Jul 2016 02:49 AM |
KeyDown is deprecated
local l={e={a={v={e=function()print("bye")end}}}} l.e.a.v.e() |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 03:06 AM |
| No its not.... My functions are working just fine.. I just need the bar to stop movin on keydown |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 02 Jul 2016 03:09 AM |
| You don't know what deprecated means AlertedDynamite |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|