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