Player not taking damage when time is stopped

So the player takes damage just fine until time is stopped. When time is stopped no damage is dealt.
TS script:

local Event = game.ReplicatedStorage.ButtonPress.Z
local InUse = script.Parent.InUse
local Cooldown = script.Parent.Cooldown
local Range = script.Parent.Range
local Lasts = script.Parent.Lasts
local Active = script.Parent.Active
local players = game:GetService("Players")
local plr = players:GetPlayerFromCharacter(script.Parent.Parent.Parent)
local TweenService = game:GetService("TweenService")
local Stand = script.Parent.Parent
local Gui = plr.PlayerGui.Cooldowns
local YesEvent = game.ReplicatedStorage.PlayerTSed
local Animation = game.ReplicatedStorage.MoveAnims.TS
local Anim = Stand.Parent.Humanoid:LoadAnimation(Animation)
local Sound = Stand.HumanoidRootPart.TSSound
local EndSound = Stand.HumanoidRootPart.TSEndSound
Anim.Priority = Enum.AnimationPriority.Action
local GC = game.ServerScriptService.GlobalTSCooldown

Event.OnServerEvent:Connect(function(Player)
	if Player == plr and not InUse.Value and GC.Value == 0 then
		if Stand.Parent.PlayerWhoTS.Value == 0 and Stand.Parent.PlayerWhoBD.Value == 0 and Stand.Parent.Stunned.Value == 0 then
			Anim:Play()
			Sound:Play()
			local Health = Stand.Parent.Humanoid.Health
			InUse.Value = true
			wait(2)
			if Health - 10 > Stand.Parent.Humanoid.Health then
				Sound:Stop()
				local Clone = game.ReplicatedStorage.Cooldown:Clone()
				Clone.Parent = Gui.Frame
				Clone.Text.Text = Stand.Name .. " " .. script.Parent.Name

				local TweenSettings = TweenInfo.new(
					Cooldown.Value / 2, --Duration
					Enum.EasingStyle.Linear, --Type of Style
					Enum.EasingDirection.In, --Type of Direction
					0, --How much times you want it repeated
					false, --Reverse the Tween
					0 --Add a delay before starting it
				)
				local TweenProperties = {
					Size = UDim2.new(0, 0, 1, 0)
				}
				local Tween = TweenService:Create(Clone.Bar, TweenSettings, TweenProperties)
				Tween:Play()

				wait(Cooldown.Value / 2)
				InUse.Value = false
				Clone:Destroy()
			else
			print("a")
			local Character = script.Parent.Parent.Parent
			local Root = Character:WaitForChild("HumanoidRootPart")
			local Radius = Root.Position + Vector3.new(Range.Value, Range.Value, Range.Value)
			local NegRadius = Root.Position - Vector3.new(Range.Value, Range.Value, Range.Value)
			local Ignore = Character:GetDescendants()
			local Region = Region3.new(NegRadius, Radius)
			local PartsInRegion = workspace:FindPartsInRegion3WithIgnoreList(Region, Ignore, math.huge)
				if #PartsInRegion >= 1 then
					GC.Value = 15
				local lkdjsflksjdfkldsj = Lasts.Value
				YesEvent:FireClient(plr, lkdjsflksjdfkldsj)
				Active.Value = true
				for i in pairs(PartsInRegion) do
					local Part = PartsInRegion[i]
					if Part.Name == "HumanoidRootPart" then
						local Char = Part.Parent
						local Human = Char:FindFirstChild("Humanoid")
						if Human then
							local NoPlayer = players:GetPlayerFromCharacter(Char)
							if NoPlayer then
								YesEvent:FireClient(NoPlayer, lkdjsflksjdfkldsj)
							end
							local PlrWhoTS = Char:FindFirstChild("PlayerWhoTS")
							PlrWhoTS.Value = plr.UserId
							local Children = Char:GetChildren()
								for _, Child in ipairs(Children) do
								local isPart = Child:IsA("Part")
								local isMesh = Child:IsA("MeshPart")
								if isPart or isMesh then
									Child.Anchored = true
								end
							end
						end
					end
				end
			end
				wait(Lasts.Value)
				EndSound:Play()
			Active.Value = false
			for f in pairs(workspace:GetChildren()) do
				local Char = workspace:GetChildren()[f]
					local PlrWhoTS = Char:FindFirstChild("PlayerWhoTS")
					local PlrWhoBD = Char:FindFirstChild("PlayerWhoBD")
				if PlrWhoTS and PlrWhoBD then
					if PlrWhoTS.Value == Player.UserId and PlrWhoBD.Value == 0 then
						PlrWhoTS.Value = 0
						local Human = Char:FindFirstChild("Humanoid")
						if Human then
							local Children = Char:GetChildren()
							for g in pairs(Children) do
								local Child = Children[g]
								local isPart = Child:IsA("Part")
								local isMesh = Child:IsA("MeshPart")
								if isPart == true or isMesh == true then
									Child.Anchored = false
								end
							end
						end
					end
				end
			end
			
			local Clone = game.ReplicatedStorage.Cooldown:Clone()
			Clone.Parent = Gui.Frame
			Clone.Text.Text = Stand.Name .. " " .. script.Parent.Name
			
			local TweenSettings = TweenInfo.new(
				Cooldown.Value, --Duration
				Enum.EasingStyle.Linear, --Type of Style
				Enum.EasingDirection.In, --Type of Direction
				0, --How much times you want it repeated
				false, --Reverse the Tween
				0 --Add a delay before starting it
			)
			local TweenProperties = {
				Size = UDim2.new(0, 0, 1, 0)
			}
			local Tween = TweenService:Create(Clone.Bar, TweenSettings, TweenProperties)
			Tween:Play()

			wait(Cooldown.Value)
				InUse.Value = false
				Clone:Destroy()
				
		end
		end
	end
end)

Attack Script:

local Stand = script.Parent.Parent
local Event = game.ReplicatedStorage.ButtonPress.M2
local Damage = script.Parent.Damage
local Cooldown = script.Parent.Cooldown
local Knockback = script.Parent.Knockback
local Stun = script.Parent.Stun
local InUse = script.Parent.InUse
local Players = game:GetService("Players")
local Player = Players:GetPlayerFromCharacter(Stand.Parent)
local Anim = game.ReplicatedStorage.MoveAnims.M2
local Animation = Stand.AnimationController.Animator:LoadAnimation(Anim)
local Hitbox = script.Parent.Hitbox
local Sound = Stand.HumanoidRootPart.M2Sound
local Clicks = 0
local Gui = Player.PlayerGui.Cooldowns
local TweenService = game:GetService("TweenService")

Event.OnServerEvent:Connect(function(plr)
	if plr == Player and not InUse.Value then
		if Stand.Parent.PlayerWhoTS.Value == 0 and Stand.Parent.PlayerWhoBD.Value == 0 and Stand.Parent.Stunned.Value == 0 then
			Clicks += 1
			if Clicks == 2 then
				Clicks = 0
				InUse.Value = true
				local JustTouched = false
				Hitbox.CanTouch = true
				Sound:Play()
				Animation:Play()
				Stand.FollowDist.Value = 2
				Stand.FollowHeight.Value = 0.2
				Hitbox.Touched:Connect(function(part)
					local Char = part.Parent
					local Humanoid = Char:FindFirstChild("Humanoid")
					if Humanoid and InUse.Value and not JustTouched then
						if Char ~= Stand.Parent and Char ~= Stand then
							JustTouched = true
							Hitbox.CanTouch = false
							Humanoid:TakeDamage(Damage.Value)
							if Stun.Value > Char.Stunned.Value then
								Char.Stunned.Value = Stun.Value
							end
							Char.PrimaryPart = Char:WaitForChild("HumanoidRootPart")
							local cf = Stand.Parent.HumanoidRootPart.CFrame
							
							local BV = Instance.new("BodyVelocity")

							BV.P = math.huge

							BV.MaxForce = Vector3.new(15000, 15000, 15000)

							BV.Velocity = Stand.Parent.PrimaryPart.CFrame.lookVector * Knockback.Value

							BV.Parent = Char.PrimaryPart

							game.Debris:AddItem(BV, 0.5)
							
						end
					end
				end)
				wait(1)
				Stand.FollowDist.Value = -3
				Stand.FollowHeight.Value = 3
				JustTouched = true
				Hitbox.CanTouch = false
				local Clone = game.ReplicatedStorage.Cooldown:Clone()
				Clone.Parent = Gui.Frame
				Clone.Text.Text = Stand.Name .. " " .. script.Parent.Name
				
				local TweenSettings = TweenInfo.new(
					Cooldown.Value - 1, --Duration
					Enum.EasingStyle.Linear, --Type of Style
					Enum.EasingDirection.In, --Type of Direction
					0, --How much times you want it repeated
					false, --Reverse the Tween
					0 --Add a delay before starting it
				)
				local TweenProperties = {
					Size = UDim2.new(0, 0, 1, 0)
				}
				local Tween = TweenService:Create(Clone.Bar, TweenSettings, TweenProperties)
				Tween:Play()
				wait(Cooldown.Value - 1)
				Clone:Destroy()
				
				Stand.FollowDist.Value = -3
				Stand.FollowHeight.Value = 3
				
				InUse.Value = false
			else
				wait(0.5)
				if Clicks <= 1 then
					Clicks = 0
				end
			end
		end
	end
end)

Sorry for the length but I had to post the whole scripts because I don’t what’s causing the problem

where exactly is this “time” and when does it stop? I don’t know what I am looking at

Basically when the player uses a move the other player can’t move or attack, until the time stop ends

can you show a video of the bug

Video (When it’s gray time is stopped)

Hitbox.Touched:Connect(function(part)

I would suggest running the same test again except:

make a print:

print("Hit " … part.Parent.Name)

pay close attention to when time is stopped and what happens when you try to touch (attack)

It just prints that it hit me when time is stopped and not the dummy (when time isn’t stopped it does print that it hit the dummy), so I guess it’s not touching them for some reason?

Okay so I have discovered that it doesn’t touch anything that’s anchored for some reason? However it does touch things that are unanchored?

It was because both the hitbox and the target were anchored lol

2 Likes