Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm trying to tween some guis for a tool but whenever it's played repeatedly it stops for a while?

Asked by 4 years ago
Edited 4 years ago

So I'm tweening GUIs I have no problem whatsoever but whenever I play the tween repeatedly the tween stops for a little bit then continues on. I don't know why this is happening but it has to do with multiple tweens happening at once.

I am only tweening for a tool when it's equipped and dequipped, I want to know if the tween can be directly interuptted.

Here's a video on youtube to see what I'm talking about:

https://youtu.be/i24V9YSj7j8

Here is the code for tweening those two guis in the video:

The code for all the tweening goals and TweenInfo:

local ScopedInCameraGoal = {
    FieldOfView = 45    
}

local ScopedOutCameraGoal = {
    FieldOfView = 70

}

local InScopedImageGoal = {
    ImageTransparency = 0   
}

local OutScopedImageGoal = {
    ImageTransparency = 1   
}

local AmmoWithdrawalGoal = {
    Position = UDim2.new(0.838, 0, 0.894, 0)    
}

local AmmoDepositGoal = {
    Position = UDim2.new(0.844, 0, 1, 0)
}


local TweeningInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
-- tweening time is 0.5

Tweening up and down the position of the ammo GUI:


-- when the tween is finished disable the ammo GUI local function WithdrawlAmmoGUI() AmmoGUI.Enabled = false end -- equipping the tool local function EquipTool() local Tween = TweenService:Create(Frame, TweeningInfo, AmmoWithdrawalGoal) Tween:Play() end -- unequipping the tool local function UnequipTool() local Tween = TweenService:Create(Frame, TweeningInfo, AmmoDepositGoal) Tween:Play() Tween.Completed:Connect(WithdrawlAmmoGUI) end

Aiming in third person and tweening the Camera's FOV and a black screen effect:


local function AimTool() local Tween = TweenService:Create(Camera, TweeningInfo, ScopedInCameraGoal) Tween:Play() OutScopeImage.Visible = true -- making the black screen visual visible local ImageTween = TweenService:Create(OutScopeImage, TweeningInfo, InScopedImageGoal) ImageTween:Play() end function UnAimTool() local Tween = TweenService:Create(Camera, TweeningInfo, ScopedOutCameraGoal) Tween:Play() local ImageTween = TweenService:Create(OutScopeImage, TweeningInfo, OutScopedImageGoal) ImageTween:Play() ImageTween.Completed:Connect(DisableScope) -- DisableScope() is just a function that makes the image not visible. end

All tweens that are tweening a GUI that is "making it disappear" will have a function in the .Connected event to fire after the tween is done to make the image that is tweened away not visible.

All tweens also use the tweeninfo, that's why I stated it as a variable so each tween can globally access it at the same time.

It's hard to explain this through just this but there is a video on youtube provided in case you missed it. I've tried to fiddle with the time it takes for the tweens to complete but that gives an uncomfortable feeling and still causes the problem

I'm not sure why this is happening and sorry if this post is a bit too long since I can't wrap my head around all of the tweening stuff. I think it has to do something with the TweenInfo and it's time parameter.

0
Sorry if there's a big space in the middle of the post I have no idea what's causing it and whenever I try to edit I don't see a big white patch of space for some reason. 123nabilben123 499 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

i saw no issue in video

0
It's where I'm spamming the equip key for my gun and the ammo status gui doesn't show up for a bit 123nabilben123 499 — 4y
0
The video is about a minute long since I showed long example so maybe you forgot to watch the entrie video 123nabilben123 499 — 4y
0
no it just looked pretty good to me, i wouldnt want ammo to come up that fast and i didnt read your code so i didnt see an issue Gameplayer365247v2 1055 — 4y
0
It does look good to me too, but players might be spamming the equip button or spamming right mouse button to aim and the GUIs may not show up for a little bit.. Is there anyway to make a "tween cooldown" or something? 123nabilben123 499 — 4y
Ad

Answer this question