Hey there! I am making a fishing system as a quest for my game, but it doesn’t work as it should. Here’s the video:
External Mediaand here is the code:
local FishingRod = script.Parent;
local Hook = FishingRod:WaitForChild('Hook')
local debounce = false
local function on_Activated()
if not debounce then
debounce = true
else
return;
end
local rope = Instance.new("RopeConstraint", Hook);
local Lure = Instance.new("Part", workspace);
Lure.Size = Vector3.new(.2, .2, .2)
Lure.CFrame = Hook.CFrame;
rope.Visible = true
rope.Length = (game.Players.LocalPlayer:GetMouse().Hit.p - Lure.CFrame.p).magnitude;
rope.Thickness = 0.5;
local attachment1 = Instance.new("Attachment")
local velo = Instance.new("BodyVelocity", Lure);
velo.MaxForce = Vector3.new(1,1,1) * math.huge
velo.P = 20
velo.Velocity = game.Players.LocalPlayer:GetMouse().Hit.lookVector * 50 + Vector3.new(0, 10, 0);
attachment1.Parent = Lure
rope.Attachment0 = Hook:FindFirstChild("Attachment")
rope.Attachment1 = attachment1
attachment1.Position += Vector3.new(0, 2.5, 0);
wait(0.5)
velo:Destroy()
Lure.CFrame = attachment1.CFrame
wait(5)
debounce = false
rope:Destroy()
Lure:Destroy()
attachment1:Destroy()
end
FishingRod.Activated:Connect(on_Activated);
Help is appreciated! Thanks!