Working in Roblox Studio but not in the actual game

Hello developers,

I’ve made an M1 script which works in Roblox Studio, but when I try it out in the actual Roblox Game, it no longer works, I checked the dev console and didn’t find any errors.

In-Game:
https://gyazo.com/815805955b4bcd5772ca424b01a7b16c

In-Studio:
https://gyazo.com/b4de1d9caac7cacecb5c5f7ab3702626

Any kind of help would be appreciated.

Looks like the dummy you are punching is anchored.
In this video

The dummies were both unanchored in both situations, the M1s don’t hit and it doesn’t deal damage. So I don’t think the issue is connected with the Dummy

Any errors in the console???

No errors at all unfortunately

Still haven’t figured out the solution to it yet

Go ingame and punch the dummy, next open the client console with f9 the error is probably there.

If there’s any error there send a Screenshot if you can.

No errors were found in the developer console. It’s just really confusing why the hitboxes actually hit in Roblox Studio but not in the actual game.

¿Can you provide the code?

Also, ¿your combat system works client → server?

Here is the local script:

local Space = false

local Clicking = false
local Clicks = 1

local StartTim = 0
local EndTim = 0

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

UserService.InputBegan:Connect(function(Input,Typer)
	if Typer then
		return
	end
	if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Clicking then
		if tors.Anchored == true then return end
		if Stunned.Value == true then return end
		if plr.Stats.CantPunch.Value == true then return end
		StartTim = tick()
		local OverTim = StartTim - EndTim
		if OverTim <= 1 and Clicks <=5 then
			MoveRemote:FireServer(Clicks,Space) -- MoveRemote is the serverscript
			if Clicks <=4 then
				Clicking = true
				Clicks = Clicks + 1	
				task.wait(0.4)
				Clicking = false
			elseif Clicks == 5 then
				Clicking = true
				Clicks = 1
				task.wait(2)	
				Clicking = false	
			end
		elseif OverTim > 1 then	
			Clicks = 1	
			MoveRemote:FireServer(Clicks,Space)
			Clicking = true
			Clicks = Clicks + 1
			task.wait(0.4)	
			Clicking = false
		end	

		EndTim = StartTim
	end
end)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

UserService.InputBegan:Connect(function(Input,Typer)
	if Typer then
		return
	end
	if Input.KeyCode == Enum.KeyCode.Space then
		Space = true
	end
end)

UserService.InputEnded:Connect(function(Input,Typer)
	if Typer then
		return
	end
	if Input.KeyCode == Enum.KeyCode.Space then
		Space = false
	end
end)

Serverscript:


local MoveRemote = game:GetService("ReplicatedStorage").Moves["Broly [DBS]"].BrolyM1s

local HandM1Range = 7
local SwordM1Range = 8
local RunAnim
function Sound(Id,Vol,PBS,Looped,Time,DesTime,Parent)
	local Sound = Instance.new("Sound",Parent)
	Sound.SoundId = Id
	Sound.Volume = Vol
	Sound.PlaybackSpeed = PBS
	Sound.Looped = Looped
	Sound.TimePosition = Time
	game.Debris:AddItem(Sound,DesTime)
	Sound:Play()
end

MoveRemote.OnServerEvent:Connect(function(Player,Key,SpaNo)
	local Character = Player.Character

	if Key == 1 then
		Character.Humanoid.JumpPower = 0
		local FightAnimation = Character.Humanoid:LoadAnimation(script.RightPunch)
		FightAnimation:Play()
		Sound("rbxassetid://9373436698",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		Sound("rbxassetid://9345549017",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		
		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,4)
		
		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,4))
		
		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5)
						Sound("rbxassetid://9373441516",1,1,false,0,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")
						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 1
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 1
						game.Debris:AddItem(CVeloCity,0.3)
					end
				end
			end
		end)

		Key = 2
		task.wait(0.4)
	elseif Key == 2 then
		Character.Humanoid.JumpPower = 0
		local FightAnimation = Character.Humanoid:LoadAnimation(script.LeftPunch)
		FightAnimation:Play()
		Sound("rbxassetid://9373436698",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		Sound("rbxassetid://9345553166",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		
		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,4)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,4))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.2)
						Sound("rbxassetid://9373441516",1,1,false,0,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 1
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 1
						game.Debris:AddItem(CVeloCity,0.3)
					end
				end
			end
		end)
		
		Key = 3
		task.wait(0.4)
		delay(0.4,function()
			Character.Humanoid.JumpPower = 50
		end)	
	elseif Key == 3 and SpaNo == false then
		Character.Humanoid.JumpPower = 0
		local FightAnimation = Character.Humanoid:LoadAnimation(script.RightPunch1)
		FightAnimation:Play()
		Sound("rbxassetid://9373436698",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		Sound("rbxassetid://9345553624",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		
		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,4)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,4))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.3)
						Sound("rbxassetid://9373441516",1,1,false,0,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 2
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 2
						game.Debris:AddItem(CVeloCity,0.3)
					end
				end
			end
		end)
		
		
	elseif Key == 3 and SpaNo == true then
		Character.Humanoid.JumpPower = 0
		local FightAnimation = Character.Humanoid:LoadAnimation(script.HitUp)
		FightAnimation:Play()
		Sound("rbxassetid://9373436698",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		Sound("rbxassetid://9345553624",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)

		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,4)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,4))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.3)
						Sound("rbxassetid://9373441516",1,1,false,0,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyPosition",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(0,60000,0)
						VeloCity.Position = Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 60
						game.Debris:AddItem(VeloCity,0.4)
						local CVeloCity = Instance.new("BodyPosition",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(0,60000,0)
						CVeloCity.Position = Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 60
						game.Debris:AddItem(CVeloCity,0.4)
					end
				end
			end
		end)
		
		Key = 4
		task.wait(0.4)
		Character.Humanoid.JumpPower = 50
	elseif Key == 4 then
		local FightAnimation = Character.Humanoid:LoadAnimation(script.LeftPunch1)
		FightAnimation:Play()
		Sound("rbxassetid://9373436698",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		Sound("rbxassetid://9345554261",0.3,math.random(1.5,1.8),false,0,1,Character.HumanoidRootPart)
		
		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,4)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,4))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.4)
						Sound("rbxassetid://9373441516",1,1,false,0,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 2
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 2
						game.Debris:AddItem(CVeloCity,0.3)
					end
				end
			end
		end)
		
		Key = 5
		task.wait(0.4)
	elseif Key == 5 and SpaNo ~= true and Character:FindFirstChild("Humanoid"):GetState() ~= Enum.HumanoidStateType.Freefall or SpaNo == false and Character:FindFirstChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall then
		local FightAnimation = Character.Humanoid:LoadAnimation(script.Kick)
		FightAnimation:Play()
		
		task.wait(0.1)
		Sound("rbxassetid://9373436698",0.4,math.random(1,1.3),false,0,3,Character.HumanoidRootPart)
		Sound("rbxassetid://9372808705",0.4,math.random(1,1.3),false,0,3,Character.HumanoidRootPart)
		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range + 1)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,5)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,5))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.5)
						Sound("rbxassetid://9373441516",2,1,false,0.04,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 100 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 60
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 20 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 4
						game.Debris:AddItem(CVeloCity,0.3)
					end
				end
			end
		end)
		
		
	elseif Key == 5 and SpaNo == true and Character:FindFirstChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall  then
		local FightAnimation = Character.Humanoid:LoadAnimation(script.Slam)
		FightAnimation:Play()

		task.wait(0.1)
		Sound("rbxassetid://9373436698",0.4,math.random(1,1.3),false,0,3,Character.HumanoidRootPart)
		Sound("rbxassetid://9373436698",0.4,math.random(1,1.3),false,0,3,Character.HumanoidRootPart)

		local HitBox = Instance.new("Part",Character)
		HitBox.Anchored = false
		HitBox.CanCollide = false
		HitBox.CanTouch = true
		HitBox.Size = Vector3.new(5,5,HandM1Range + 1)
		HitBox.Massless = true
		HitBox.Transparency = 1
		HitBox.Material = "ForceField"
		HitBox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,5)

		local HitBoxWeld = Instance.new("Weld",HitBox)
		HitBoxWeld.Part0 = HitBox
		HitBoxWeld.Part1 = Character.HumanoidRootPart
		HitBoxWeld.C0 = HitBoxWeld.Part0.CFrame:ToObjectSpace(HitBoxWeld.Part1.CFrame * CFrame.new(0,0,5))

		game.Debris:AddItem(HitBox,0.2)
		game.Debris:AddItem(HitBoxWeld,0.2)
		
		HitBox.Touched:Connect(function(a)
			if a:IsA("BasePart") and a.Name == "HumanoidRootPart" then
				if a.Parent:IsA("Model") and a.Parent.Name ~= Character.Name then
					if a.Parent:FindFirstChild("Humanoid") and a.Parent:FindFirstChild("Humanoid").Health > 0 and a.Parent ~= Character and not a.Parent:FindFirstChild("M1Hit") then
						a.Parent:FindFirstChild("Humanoid"):TakeDamage(5.5)
						Sound("rbxassetid://9373441516",2,1,false,0.04,1,a.Parent:FindFirstChild("HumanoidRootPart"))
						
						local FX = script:WaitForChild("BrolyFX")
						local attachment = Instance.new("Attachment")

						local hit1 = FX:FindFirstChild("Hit1"):Clone()
						local hit2 = FX:FindFirstChild("Hit2"):Clone()
						local hit3 = FX:FindFirstChild("Hit3"):Clone()
						local balls = FX:FindFirstChild("Balls"):Clone()
						local lines = FX:FindFirstChild("Lines"):Clone()
						local wave = FX:FindFirstChild("Wave"):Clone()

						hit1.Parent = attachment
						hit2.Parent = attachment
						hit3.Parent = attachment
						balls.Parent = attachment
						lines.Parent = attachment
						wave.Parent = attachment
						attachment.Parent = a

						balls.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
						hit1.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						hit2.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
						hit3.Color = ColorSequence.new(Color3.fromRGB(85, 255, 127))
						lines.Color = ColorSequence.new(Color3.fromRGB(0, 0, 0))
						wave.Color = ColorSequence.new(Color3.fromRGB(0, 170, 0))

						hit1:Emit(1)
						hit2:Emit(1)
						hit3:Emit(1)
						balls:Emit(25)
						lines:Emit(20)
						wave:Emit(1)
						game.Debris:AddItem(hit1, 1)
						game.Debris:AddItem(hit2, 1)
						game.Debris:AddItem(hit3, 1)
						game.Debris:AddItem(balls, 1)
						game.Debris:AddItem(lines, 1)
						game.Debris:AddItem(wave, 1)
						local FolderHit = Instance.new("Folder",a.Parent)	
						FolderHit.Name = "M1Hit"
						game.Debris:AddItem(FolderHit,0.2)	
						local VeloCity = Instance.new("BodyVelocity",a.Parent:FindFirstChild("HumanoidRootPart"))
						VeloCity.MaxForce = Vector3.new(60000,60000,60000)
						VeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 5 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * -120
						game.Debris:AddItem(VeloCity,0.3)
						local CVeloCity = Instance.new("BodyVelocity",Character:FindFirstChild("HumanoidRootPart"))
						CVeloCity.MaxForce = Vector3.new(60000,60000,60000)
						CVeloCity.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 5 + Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector * 4
						game.Debris:AddItem(CVeloCity,0.45)
					end
				end
			end
		end)
		
		Key = 1
		task.wait(1.9)
	end
end)

It is really strange why it only works in Roblox Studio