ApplyImpulse not working on Tool.Parent

local Tool = script.Parent
local Part = Tool.Part
local Active = true
local Activated = true
local Working = true
local EP

game.ReplicatedStorage.Gun.OnServerEvent:Connect(function(Player, Mouse)
	if Active then
		Active = false
		local RayDirection = (Mouse - Part.Position).Unit
		local RParams = RaycastParams.new()
		RParams.FilterType = Enum.RaycastFilterType.Exclude
		RParams.FilterDescendantsInstances = {Player.Character}
		local TweenService = game:GetService("TweenService")
		local TInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
		local NewPart = Instance.new("Part")
		local Raycast = workspace:Raycast(Part.Position, RayDirection * 1000, RParams)
		NewPart.Size = Vector3.new(1, 1, 1)
		NewPart.Anchored = true
		NewPart.CanCollide = false
		NewPart.CFrame = CFrame.new(Part.Position, Mouse)
		NewPart.Position = Part.Position
		NewPart.Parent = workspace
		NewPart.Velocity = NewPart.CFrame.LookVector * 80

		if not Raycast then
			NewPart:Destroy()
		end
		if Raycast then
			local Tween = TweenService:Create(NewPart, TInfo, {Position = Raycast.Position})
			Tween:Play()
		end

		NewPart.Touched:Connect(function(Hit)
			local Plr = Tool.Parent
			local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
			
			if Hit and Activated then
				Activated = false
				task.wait()
				EP = Instance.new("Part")
				EP.Transparency = 0.6
				EP.Shape = Enum.PartType.Ball
				local Tween = TweenService:Create(EP, TInfo, {Size = Vector3.new(10, 10, 10)})
				Tween:Play()
				EP.Anchored = true
				EP.CanCollide = false
				EP.Position = NewPart.Position
				EP.Parent = workspace
				
				EP.Touched:Connect(function(Launch)
					if Launch and Humanoid.Parent:FindFirstChild("HumanoidRootPart") then
						Humanoid.Parent.HumanoidRootPart:ApplyImpulse(Vector3.new(0, 100, 0))
					end
					if Launch.Parent == Plr then
						print("Yes")
						Plr.HumanoidRootPart:ApplyImpulse(Vector3.new(0, 100, 0))
					end
				end)
				
				EP.Touched:Connect(function(Touch)
					if Touch.Parent ~= Plr and Humanoid ~= Plr.Humanoid and Working then
						Working = false
						task.wait()
						Humanoid:TakeDamage(33.4)
						task.wait(0.345)
						Working = true
					end
				end)

				wait(0.500)
				EP:Destroy()
				Activated = true
			end
		end)
		wait(1)
		NewPart:Destroy()
		Active = true
	end
end)

On line 58 ApplyImpulse isn’t working on Tool.Parent. The same thing’s happening on line 54. Pls help!! Also what are some of the better ways to launch a player or Tool.Parent not only for 1 direction?

1 Like

Sooo… I found out that I could’ve just made a new Instance called “Explosion”

1 Like

I know this is solved, but the original issue might be the fact that the player has the Network Ownership of the tool.

1 Like

The player would take damage though

1 Like

No, Network Ownership means that all physics related stuff will be done on the Network Owner.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.