Why won't the object launch the player most of the times?

The ball would work as intended when you’re close enough but it just puts you in place when you’re at a far distance from your target.

The video below will show you how it should work and the error:

Here’s the server script:
(Disclaimer, it is not the full script but a portion of what you should need to know)

local ball = rs.Ball:Clone()
local character = plr.Character
local sounds = character.Sounds

ball.Touched:Connect(function(h)
	if h.Parent and h.Parent.Name ~= plr.Name then
		local echaracter = h.Parent
		if echaracter and echaracter:IsA("Model") and echaracter:FindFirstChild("Humanoid") then
			local targetHumanoid = echaracter:FindFirstChild("Humanoid")
			local targetTorso = echaracter:FindFirstChild("HumanoidRootPart")

			local plrHumanoid = character:FindFirstChild("Humanoid")
			local plrTorso = character:FindFirstChild("HumanoidRootPart")

			local erd = echaracter.Values:FindFirstChild("IsRagdoll")
			local rd = character.Values:FindFirstChild("IsRagdoll")

			local esounds = echaracter.Sounds
			if targetTorso then
				erd.Value = true
				targetHumanoid.WalkSpeed = 0
				ball.explode_1:Play()
				esounds.scream:Play()
				disableBall(ball)
				local velocity = dir * 750
				echaracter.HumanoidRootPart.Velocity = velocity
				wait(2)
				erd.Value = false
				targetHumanoid.WalkSpeed = 25
			end
		end
	end
end)

Thank you in advance.

Have you tried this in a real game and not against NPCs? This could just be a NetworkOwnership problem. I’m assuming this script is also a server-script and not a LocalScript but correct me if I’m wrong.

1 Like

Yeah, tried it with my friends. Only works when you’re up-close to the opponent.

Does the touch event fire when far away?

Yes it does, there are no problems with the touch event.

Is there any errors? If not then use print checks to find the line that doesn’t work

There aren’t any errors in the Output it’s just like that

Have you figured out which line doesn’t work? Just using “prints”

1 Like

I set the NetworkOwnership to the server before setting velocity.

Code:

local Players = game:GetService("Players")
local ball = rs.Ball:Clone()
local character = plr.Character
local sounds = character.Sounds

ball.Touched:Connect(function(h)
	if h.Parent.Name == plr.Name then
		continue
	end
	
	local echaracter = h.Parent
	local ePlayer = Players:GetPlayerFromCharacter(echaracter)
	
	if ePlayer and echaracter:FindFirstChild("Humanoid") then
		local targetHumanoid = echaracter.Humanoid
		local targetTorso = echaracter:FindFirstChild("HumanoidRootPart")

		local erd = echaracter.Values:FindFirstChild("IsRagdoll")

		local esounds = echaracter.Sounds
		
		if targetTorso then
			erd.Value = true
			
			targetHumanoid.WalkSpeed = 0
			
			ball.explode_1:Play()
			esounds.scream:Play()
			
			disableBall(ball)
			
			local velocity = dir * 750
			echaracter:SetNetworkOwner(nil)
			echaracter.HumanoidRootPart.Velocity = velocity
			
			task.wait(2)
			echaracter.HumanoidRootPart:SetNetworkOwner(ePlayer)
			erd.Value = false
			targetHumanoid.WalkSpeed = 25
		end
	end
end)

Okay, so when I asked my friends to test it out a day later it’s still not working.