--========================================================-- -- ULTRA INSTINCT DODGE(FIXES VERSION)========================================================-- local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer --========================================================-- -- SETTINGS --========================================================-- local LEFT_EMOTE_ID = 90488938832099 local RIGHT_EMOTE_ID = 88170433716621 local CROUCH_EMOTE_ID = 137710349373014 local LEFT_DURATION = 1.75 local RIGHT_DURATION = 0.75 local CROUCH_DURATION = 0.75 local DODGE_DISTANCE = 5 local CROUCH_DOWN = 0.6 local DODGE_SOUND_ID = "rbxassetid://7251381246" --========================================================-- -- CHARACTER --========================================================-- local character = nil local humanoid = nil local root = nil local characterVersion = 0 local dodging = false local dodgeNumber = 0 local dodgeToken = 0 local currentTween = nil local currentTrack = nil --========================================================-- -- ORIGINAL COLLISION -- -- IMPORTANT: -- These values stay saved for the ENTIRE life of -- the character. They are NOT cleared after each dodge. --========================================================-- local originalCollision = {} --========================================================-- -- MOVEMENT SAVE --========================================================-- local savedWalkSpeed = 16 local savedJumpPower = 50 local savedJumpHeight = 7.2 local savedAutoRotate = true local savedUseJumpPower = true --========================================================-- -- CLEAR OLD DATA --========================================================-- local function clearOldData() table.clear(originalCollision) currentTween = nil currentTrack = nil character = nil humanoid = nil root = nil dodging = false dodgeNumber = 0 end --========================================================-- -- SAVE ORIGINAL COLLISION --========================================================-- local function saveOriginalCollision(char) table.clear(originalCollision) for _, obj in ipairs(char:GetDescendants()) do if obj:IsA("BasePart") then originalCollision[obj] = obj.CanCollide end end end --========================================================-- -- RESTORE ORIGINAL COLLISION -- -- FIX: -- DO NOT clear originalCollision here. -- -- The saved values must survive multiple dodges. --========================================================-- local function restoreOriginalCollision(char) if not char then return end for part, originalValue in pairs(originalCollision) do if part and part.Parent and part:IsDescendantOf(char) and part:IsA("BasePart") then part.CanCollide = originalValue end end end --========================================================-- -- DISABLE COLLISION --========================================================-- local function disableDodgeCollision(char) if not char then return end for _, obj in ipairs(char:GetDescendants()) do if obj:IsA("BasePart") then obj.CanCollide = false end end end --========================================================-- -- STOP OLD TWEEN --========================================================-- local function cancelCurrentTween() if currentTween then pcall(function() currentTween:Cancel() end) currentTween = nil end end --========================================================-- -- STOP OLD ANIMATION --========================================================-- local function stopCurrentAnimation(hum) if not hum then return end local animator = hum:FindFirstChildOfClass("Animator") if animator then for _, track in ipairs( animator:GetPlayingAnimationTracks() ) do pcall(function() track.Looped = false track:Stop(0) end) end end currentTrack = nil end --========================================================-- -- RESTORE MOVEMENT --========================================================-- local function restoreMovement(hum) if not hum then return end hum.WalkSpeed = savedWalkSpeed if savedUseJumpPower then hum.JumpPower = savedJumpPower else hum.JumpHeight = savedJumpHeight end hum.AutoRotate = savedAutoRotate hum:SetStateEnabled( Enum.HumanoidStateType.Jumping, true ) end --========================================================-- -- CHARACTER SETUP --========================================================-- local function setupCharacter(newCharacter) --====================================================-- -- INVALIDATE OLD CHARACTER --====================================================-- characterVersion += 1 local thisCharacterVersion = characterVersion dodgeToken += 1 cancelCurrentTween() -- Clear ONLY because this is a brand-new character. table.clear(originalCollision) dodging = false dodgeNumber = 0 currentTrack = nil --====================================================-- -- SET NEW CHARACTER --====================================================-- character = newCharacter humanoid = character:WaitForChild("Humanoid") root = character:WaitForChild( "HumanoidRootPart" ) --====================================================-- -- SAVE ORIGINAL COLLISION --====================================================-- saveOriginalCollision(character) --====================================================-- -- NORMAL MOVEMENT --====================================================-- humanoid.WalkSpeed = 16 if humanoid.UseJumpPower then humanoid.JumpPower = 50 else humanoid.JumpHeight = 7.2 end humanoid.AutoRotate = true humanoid:SetStateEnabled( Enum.HumanoidStateType.Jumping, true ) --====================================================-- -- DEATH CLEANUP --====================================================-- humanoid.Died:Connect(function() if thisCharacterVersion ~= characterVersion then return end -- Invalidate all old dodge timers. dodgeToken += 1 dodging = false cancelCurrentTween() stopCurrentAnimation(humanoid) -- Restore this character one final time. restoreOriginalCollision(character) -- Now it is safe to clear it because -- this character is dead. table.clear(originalCollision) end) --====================================================-- -- EXTRA BODY PART SAFETY --====================================================-- character.DescendantAdded:Connect(function(obj) if thisCharacterVersion ~= characterVersion then return end if obj:IsA("BasePart") then -- Save new parts only when the character -- is not currently dodging. if not dodging then originalCollision[obj] = obj.CanCollide end end end) end --========================================================-- -- INITIAL CHARACTER --========================================================-- if player.Character then setupCharacter( player.Character ) end --========================================================-- -- RESPAWN --========================================================-- player.CharacterAdded:Connect(function(newCharacter) setupCharacter(newCharacter) end) --========================================================-- -- LOCK MOVEMENT --========================================================-- local function lockMovement() if not humanoid then return end savedWalkSpeed = humanoid.WalkSpeed savedJumpPower = humanoid.JumpPower savedJumpHeight = humanoid.JumpHeight savedAutoRotate = humanoid.AutoRotate savedUseJumpPower = humanoid.UseJumpPower humanoid.WalkSpeed = 0 if humanoid.UseJumpPower then humanoid.JumpPower = 0 else humanoid.JumpHeight = 0 end humanoid.AutoRotate = false humanoid:SetStateEnabled( Enum.HumanoidStateType.Jumping, false ) end --========================================================-- -- DODGE SOUND --========================================================-- local function playDodgeSound() if not root then return end local sound = Instance.new("Sound") sound.Name = "UltraInstinctDodgeSound" sound.SoundId = DODGE_SOUND_ID sound.Volume = 1 sound.Parent = root sound:Play() sound.Ended:Connect(function() if sound then sound:Destroy() end end) task.delay(3, function() if sound and sound.Parent then sound:Destroy() end end) end --========================================================-- -- PLAY EMOTE --========================================================-- local function playEmote(emoteId) if not humanoid then return end stopCurrentAnimation(humanoid) local success, track = pcall(function() return humanoid: PlayEmoteAndGetAnimTrackById( emoteId ) end) if success and track then currentTrack = track pcall(function() track.Looped = false track:Play() end) end end --========================================================-- -- MOVE SIDEWAYS --========================================================-- local function moveSideways( direction, token, version ) if not root then return end if token ~= dodgeToken then return end if version ~= characterVersion then return end local targetCFrame = root.CFrame + ( root.CFrame.RightVector * direction * DODGE_DISTANCE ) local tween = TweenService:Create( root, TweenInfo.new( 0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out ), { CFrame = targetCFrame } ) -- Only this dodge owns this tween. currentTween = tween tween:Play() tween.Completed:Wait() -- Don't let an old tween clear a newer tween. if currentTween == tween then currentTween = nil end end --========================================================-- -- CROUCH --========================================================-- local function crouchMove( token, version ) if not root then return end if token ~= dodgeToken then return end if version ~= characterVersion then return end local originalCFrame = root.CFrame local downCFrame = originalCFrame + Vector3.new( 0, -CROUCH_DOWN, 0 ) --====================================================-- -- MOVE DOWN --====================================================-- local downTween = TweenService:Create( root, TweenInfo.new( 0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out ), { CFrame = downCFrame } ) currentTween = downTween downTween:Play() downTween.Completed:Wait() if token ~= dodgeToken then return end if version ~= characterVersion then return end if currentTween == downTween then currentTween = nil end --====================================================-- -- MOVE BACK UP --====================================================-- local upTween = TweenService:Create( root, TweenInfo.new( 0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.In ), { CFrame = originalCFrame } ) currentTween = upTween upTween:Play() upTween.Completed:Wait() if version ~= characterVersion then return end if currentTween == upTween then currentTween = nil end end --========================================================-- -- END DODGE --========================================================-- local function endDodge( token, version ) --====================================================-- -- OLD DODGE PROTECTION --====================================================-- if token ~= dodgeToken then return end if version ~= characterVersion then return end if not character or not humanoid then return end --====================================================-- -- END CURRENT DODGE --====================================================-- dodging = false stopCurrentAnimation(humanoid) --====================================================-- -- RESTORE ORIGINAL COLLISION -- -- The saved table is intentionally NOT cleared. --====================================================-- restoreOriginalCollision(character) --====================================================-- -- RESTORE MOVEMENT --====================================================-- restoreMovement(humanoid) end --========================================================-- -- MAIN DODGE --========================================================-- local function dodge() if not character or not humanoid or not root then return end if humanoid.Health <= 0 then return end --====================================================-- -- NEW DODGE TOKEN --====================================================-- dodgeToken += 1 local token = dodgeToken local version = characterVersion --====================================================-- -- LOCK MOVEMENT --====================================================-- if not dodging then dodging = true lockMovement() end --====================================================-- -- DISABLE COLLISION --====================================================-- disableDodgeCollision(character) --====================================================-- -- CANCEL ONLY THE OLD MOVEMENT --====================================================-- cancelCurrentTween() --====================================================-- -- NEXT DODGE --====================================================-- dodgeNumber += 1 if dodgeNumber > 3 then dodgeNumber = 1 end playDodgeSound() --====================================================-- -- 1: LEFT --====================================================-- if dodgeNumber == 1 then playEmote( LEFT_EMOTE_ID ) task.spawn(function() moveSideways( -1, token, version ) end) task.delay( LEFT_DURATION, function() endDodge( token, version ) end ) --====================================================-- -- 2: RIGHT --====================================================-- elseif dodgeNumber == 2 then playEmote( RIGHT_EMOTE_ID ) task.spawn(function() moveSideways( 1, token, version ) end) task.delay( RIGHT_DURATION, function() endDodge( token, version ) end ) --====================================================-- -- 3: CROUCH --====================================================-- elseif dodgeNumber == 3 then playEmote( CROUCH_EMOTE_ID ) task.spawn(function() crouchMove( token, version ) end) task.delay( CROUCH_DURATION, function() endDodge( token, version ) end ) end end --========================================================-- -- GUI --========================================================-- local playerGui = player:WaitForChild("PlayerGui") local oldGui = playerGui:FindFirstChild( "UltraInstinctGui" ) if oldGui then oldGui:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "UltraInstinctGui" gui.DisplayOrder = 999999 gui.ResetOnSpawn = false gui.Parent = playerGui --========================================================-- -- BUTTON --========================================================-- local button = Instance.new("TextButton") button.Name = "UltraInstinctButton" button.Size = UDim2.new( 0, 155, 0, 65 ) button.Position = UDim2.new( 1, -175, 1, -105 ) button.BackgroundTransparency = 0.15 button.Text = "ULTRA\nINSTINCT" button.TextScaled = true button.TextWrapped = true button.Font = Enum.Font.GothamBold button.TextColor3 = Color3.new( 1, 1, 1 ) button.Parent = gui --========================================================-- -- CORNER --========================================================-- local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new( 0, 18 ) corner.Parent = button --========================================================-- -- STROKE --========================================================-- local stroke = Instance.new("UIStroke") stroke.Thickness = 3 stroke.Parent = button --========================================================-- -- MOBILE --========================================================-- button.Activated:Connect(function() dodge() end) --========================================================-- -- PC Q --========================================================-- UserInputService.InputBegan:Connect( function(input, processed) if processed then return end if input.KeyCode == Enum.KeyCode.Q then dodge() end end )