Fishing/casting doesnt stop when rod unequipped

Hello,

I have a fishing system that works decently, but the problem is that when the player unequips the rod in the middle of a cast (or while currently fishing,) it does not stop. In a local script in the rod, I have a function that fires a remote event (in the rod) to the server. In the main rod script, on the server event, it’s supposed to start a function that tells the rod to stop doing everything, but it doesnt work.

Please help

local script:

mouse.Button1Up:Connect(function()
	if isEquipped and not hasDied then
		if not script.Parent.isThrown.Value then
			if Pointer:FindFirstChild("Effect") then 
				Pointer:FindFirstChild("Effect").Enabled = false
				Pointer:FindFirstChild("Effect"):Destroy()
				return
			end
			if Player.Character:FindFirstChild("Fish") then return end
			RemoteThrow:FireServer(mouse.Hit, HumanoidRootPart.CFrame, script.Parent.MaxLength.Value, Speed, Player)
			if Pointer:FindFirstChild("Effect") then 
				Pointer:FindFirstChild("Effect"):Destroy()
				Pointer:FindFirstChild("Effect").Enabled = false
				return
			end
		else
			RemoteRetract:FireServer(mouse.Hit, HumanoidRootPart.CFrame, Player) --part im talking about
			if not FishEating.Value then 
			 if Pointer:FindFirstChild("Effect") then 
				Pointer:FindFirstChild("Effect").Enabled = false
				end
			end
			if not FishEating.Value then return end
			All:WaitForChild("Events").HaveFish:FireServer(Player,script.Parent.Name,Pointer)
			if Pointer:FindFirstChild("Effect") then 
				FishEating.Value = true
				Pointer:FindFirstChild("Effect").Enabled = false
				Pointer:FindFirstChild("Effect"):Destroy()
				wait()
				return
			end
		end
	end
end)

Server script:

local function onRetract(player, mouse, rootpart, LP)
	if player.Name == Tool.Parent.Name then
		
		if Tool.isThrown.Value then
			player.Character.HumanoidRootPart.Anchored = false
			script.Parent.casted.Value = false
			local bv = Pointer:FindFirstChild("BodyVelocity")
			if bv then
				bv:Destroy()
			end
			Tool.isThrown.Value = false
			local length = (mouse.p - rootpart.Position).Magnitude
			local factor = 1
			attach(Pointer, Device, CFrame.new(0,0,0))
			InWater = false
			FishEating.Value = false
			if Point:FindFirstChild("Effect") then 
				Point:FindFirstChild("Effect").Enabled = false
				Point:FindFirstChild("Effect"):Destroy()
				InWater = false
			end
			if Point:FindFirstChild("Effect") then
				Point:FindFirstChild("Effect").Enabled = false
				Point:FindFirstChild("Effect"):Destroy()
			end
			Pointer.RopeConstraint.Length = 1
			Pointer.Anchored = false
			InWater = false
			if Point:FindFirstChild("Effect") then
				Point:FindFirstChild("Effect").Enabled = false
				Point:FindFirstChild("Effect"):Destroy()
							
			end
		end
	end
end

RemoteThrow.OnServerEvent:Connect(onThrow)
RemoteRetract.OnServerEvent:Connect(onRetract) --part im talking about

The part in question is it in the workspace or a folder you can clean up?

The tool, when equipped, is a child of the character. That includes all the parts of the rod

I meant the float/part in the water. It’s in the workspace right?

1 Like

It’s in the rod too, should I put it in the workspace?