RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"line 55 i only want it to play unless gui size doesnt == normalSize"
-- roblox script local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local head = character:WaitForChild("Head") local drown = Instance.new("Sound") drown.SoundId = "rbxassetid://6556968450" drown.Parent = head drown.Name = "bad" drown.Looped = true drown.Volume = 0.3 drown.PlaybackSpeed = 0.5 drown:Stop() local breath = Instance.new("Sound") breath.SoundId = "rbxassetid://360202811" breath.Parent = head breath.Name = "good" breath.Looped = true breath.Volume = 0.3 local humanoid = character:WaitForChild("Humanoid") local gui1 = player.PlayerGui.Oxygen.BarGray local gui = player.PlayerGui.Oxygen.BarGray.Bar local imageLabel = player.PlayerGui.Oxygen.Drown local tweenService = game:GetService("TweenService") local swimSize = UDim2.new(0, 0, 0, 6) local normalSize = UDim2.new(0, 363, 0, 6) local swimTween = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) local normalTween = TweenInfo.new(6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) local swimTween = tweenService:Create(gui, swimTween, {Size = swimSize}) local normalTween = tweenService:Create(gui, normalTween, {Size = normalSize}) while true do if gui.Size == normalSize then gui1.Visible = false local transparencyTween = tweenService:Create(imageLabel, TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}) transparencyTween:Play() end if humanoid:GetState() == Enum.HumanoidStateType.Swimming then gui1.Visible = true swimTween:Play() if gui.Size == swimSize then humanoid.Health = humanoid.Health - 3 if not drown.IsPlaying then drown:Play() drown.PlaybackSpeed = 0.5 end if breath.IsPlaying then breath:Stop() end local transparencyTween = tweenService:Create(imageLabel, TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 0}) transparencyTween:Play() end else drown:Stop() normalTween:Play() if not breath.IsPlaying and gui.Size ~= normalSize then breath:Play() end if gui.Size == normalSize then if breath.IsPlaying then breath:Stop() end end end task.wait(0.2) end