Debounce certain parts of code?
Hey all, I am currently having troubles with debounce. I am attempting to Debounce the first half of my code until the second half is complete. However when I attempt to do this, the code is debounced but the second half doesn't play out. Any reasons why?
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local rp = game.ReplicatedStorage |
05 | UIS.InputBegan:Connect( function (input,isTyping) |
08 | elseif input.KeyCode = = Enum.KeyCode.Q then |
10 | rp.DefStand.Summon:FireServer() |
15 | UIS.InputBegan:Connect( function (input,isTyping) |
18 | elseif input.KeyCode = = Enum.KeyCode.Q then |
19 | rp.DefStand.Callbackstand:FireServer() |
Server script
01 | game:GetService( "ReplicatedStorage" ).DefStand.Summon.OnServerEvent:Connect( function (player) |
02 | local sound = workspace.DS_summon |
03 | local Stand = game:GetService( "ServerStorage" ).DefaultStand:Clone() |
04 | local StandModel = Stand.Dummy:Clone() |
05 | local debounce = false |
08 | StandModel.Parent = workspace |
10 | local function summonWeld() |
11 | local char = player.Character or player.CharacterAdded:Wait() |
12 | local weld = Instance.new( "WeldConstraint" ) |
14 | weld.Parent = game.Workspace |
15 | weld.Part 0 = char.HumanoidRootPart |
16 | weld.Part 1 = StandModel.HumanoidRootPart |
19 | StandModel.Position = Vector 3. new (player.Character.UpperTorso.Position.X,player.Character.UpperTorso.Position.Y,player.Character.UpperTorso.Position.Z) |
23 | game:GetService( "ReplicatedStorage" ).DefStand.Callbackstand.OnServerEvent:Connect( function () |
24 | local Stand = game.Workspace.Dummy |
26 | local Stand = game.Workspace.Dummy:Destroy() |