I’m making a fishing system similar to MeepCity’s, and when I try to tween the fish to a random position within a range (a part that spans the size of the lake), it snaps instead, and only sometimes moves smoothly.
-- localscript that handles the movement of the fish
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
local rng = Random.new()
local spawnRE = RS:WaitForChild("SpawnFish")
local caughtRE = RS:WaitForChild("FishCaught")
local lakePart = game.Workspace:WaitForChild("LakePart")
local bubbles = script:WaitForChild("Bubbles")
local xRange = lakePart.Size.X * 0.5
local zRange = lakePart.Size.Z * 0.5
spawnRE.OnClientEvent:Connect(function(plr)
local bubbleClone = bubbles:Clone()
bubbleClone.Parent = game.Workspace
bubbleClone.Position = lakePart.Position + Vector3.new(math.random(0 - xRange, xRange), 0, math.random(0 - zRange, zRange))
while true do
TS:Create(bubbleClone, TweenInfo.new(rng:NextInteger(0.3, 1)),
{ Position = lakePart.Position + Vector3.new(math.random(0 - xRange, xRange), 0, math.random(0 - zRange, zRange))}
):Play()
wait(rng:NextInteger(1, 2))
end
end)
(fish is the blue outline)