sound:Play() on line 77 keeps looping no matter what I do?
Recently I have taken up the hobby of coding; however it has been a rough start. Thanks to this forum's help, I have been able to script an almost working Summon script for a game. Just as a tested the script for the last run, I ran into a problem where the script loops itself even though function has ended. I figured out somewhat that the problem may be coming from the IsTyping command as nothing happens when I move; however I have now idea how to fix it as I have only been coding for 2 or 3 days and the script is an amalgamation of multiple tutorials and solutions. How do I fix this problem.
Here is the code if it helps (Problem targets: Lines 77 and 13)
001 | local UIS = game:GetService( 'UserInputService' ) |
002 | local plr = game.Players.LocalPlayer |
003 | local Char = plr.Character or plr.CharacterAdded:Wait() |
007 | local Anim = Instance.new( "Animation" ) |
012 | UIS.InputBegan:Connect ( function (Input, IsTyping) |
013 | if IsTyping then return |
016 | local KeyPressed = Input.KeyCode |
017 | if KeyPressed = = Enum.KeyCode.L and Debounce then |
019 | local LoadAnimation = Char.Humanoid:LoadAnimation(Anim) |
021 | print ( "The Crimson God Has Been Summoned; Run..." ) |
026 | if CrimGod = = true then |
027 | local sound 1 = game.Workspace.ChargeUp |
033 | local orb = game.Workspace.Part |
036 | local player = game.Players.LocalPlayer |
037 | local character = player.Character or player.CharacterAdded:wait() |
038 | orb.Shape = "Cylinder" |
039 | orb.Material = "Neon" |
040 | local weld = Instance.new( "WeldConstraint" ) |
041 | weld.Parent = workspace |
043 | weld.Part 1 = character.HumanoidRootPart |
044 | if player.Character:FindFirstChild( "Torso" ) = = nil then |
045 | orb.Position = Vector 3. new (player.Character.LowerTorso.Position.X,player.Character.LowerTorso.Position.Y,player.Character.LowerTorso.Position.Z) |
047 | orb.Position = Vector 3. new (player.Character.Torso.Position.X,player.Character.Torso.Position.Y,player.Character.Torso.Position.Z) |
053 | local tweenService = game:GetService( "TweenService" ) |
054 | local part = game.Workspace.Part |
055 | local tweeningInformation = TweenInfo.new( |
058 | Enum.EasingStyle.Cubic, |
059 | Enum.EasingDirection.InOut, |
065 | local partProperties = { |
067 | Size = Vector 3. new( 877.04 , 149.27 , 80.24 ); |
071 | local tween = tweenService:Create(part,tweeningInformation,partProperties) |
076 | local sound = game.Workspace.ChargeUpBOOM |
078 | local exppart = game.Workspace.CrimEXP |
081 | local player = game.Players.LocalPlayer |
082 | local character = player.Character or player.CharacterAdded:wait() |
083 | exppart.Material = "Neon" |
084 | local weld = Instance.new( "WeldConstraint" ) |
085 | weld.Parent = workspace |
087 | weld.Part 1 = character.HumanoidRootPart |
088 | if player.Character:FindFirstChild( "Torso" ) = = nil then |
089 | exppart.Position = Vector 3. new (player.Character.LowerTorso.Position.X,player.Character.LowerTorso.Position.Y,player.Character.LowerTorso.Position.Z) |
091 | exppart.Position = Vector 3. new (player.Character.Torso.Position.X,player.Character.Torso.Position.Y,player.Character.Torso.Position.Z) |
095 | local tweenService = game:GetService( "TweenService" ) |
096 | local part = game.Workspace.CrimEXP |
097 | part.BrickColor = BrickColor.new( "Crimson" ) |
098 | local tweeningInformation = TweenInfo.new( |
101 | Enum.EasingStyle.Cubic, |
102 | Enum.EasingDirection.InOut, |
108 | local partProperties = { |
110 | Size = Vector 3. new( 877.04 , 149.27 , 80.24 ); |
114 | local tween = tweenService:Create(part,tweeningInformation,partProperties) |
121 | local part = game.Workspace.Part |
125 | local character = plr.Character or plr.CharacterAdded:Wait() |
127 | local Anim = Instance.new( "Animation" ) |
129 | local LoadAnimation = character.Humanoid:LoadAnimation(Anim) |
132 | if game.Workspace.ChargeUpBOOM.IsPlaying then |