I’ve been trying to make a fishing rod using vector forces that shoots the bobber straight out in front of the player, but weird stuff keeps happening (I’m not the greatest scripter)
Code of fishing rod:
local rod = script.Parent
-- vars for casting physics + line tween
local bobClone = script.Parent.bobber:Clone()
local Vy = bobClone.CastVectorForceY
local Vx = bobClone.CastVectorForceX
local tweenService = game:GetService("TweenService")
local line = bobClone.RopeConstraint
local tweenInfo = TweenInfo.new(.7)
local tweenGoal = {Length = 41}
bobClone.WeldConstraint:Destroy()
-- func for line tween
local lineTween = coroutine.create(function()
local tween = tweenService:Create(line, tweenInfo, tweenGoal)
tween:Play()
end)
rod.Activated:Connect(function()
-- Start Cast
coroutine.resume(lineTween)
print("passed line tween coroutine")
script.Parent.bobber.Transparency = 1
script.Parent.bobber.CanCollide = false
bobClone.Parent = script.Parent
bobClone.Position = script.Parent.bobber.Position
bobClone.Transparency = 0
bobClone.CanCollide = true
Vy = bobClone.CastVectorForceY
Vx = bobClone.CastVectorForceX
--Vy.RelativeTo = script.Parent.bobber.CastVectorForceY.RelativeTo
--Vx.RelativeTo = script.Parent.bobber.CastVectorForceX.RelativeTo
Vx.Enabled = true
Vy.Enabled = true
wait(.25)
Vx.Enabled = false
Vy.Enabled = false
end)
Video of fishing rod
https://gyazo.com/a51e7bafdeddd0ad57a5f8a7e03ebd17
Fishing rod parts
https://gyazo.com/bd2f10d7359b5806b3325748a35eb7ee (Disabled scripts for testing stuff, not used)
Both vector forces are using BobberAttachment as their RelativeTo. I also tried using PartAttachment0 as the RelativeTo with weird results as well.