Pick a random fish model from ReplicatedStorage (i.e Lingcod)
Choose a number from said fish’s weight range (30-60 kg)
Create a tool with the model selected from ReplicatedStorage with the selected weight (i.e. 45.74 kg) and size it proportionally
when the reeling minigame is complete, put the fish in the player’s backpack
There’s plenty of resources on the DevForum that already exist. Also, “Please do not ask people to write entire scripts or design entire systems for you.” Instead, start working on the script and create a post if you have problems with it.
Basic script plan:
Random Fish Model: Simply use a weighted randomizer function on a table of all possible fish and select that fish in ReplicatedStorage
Random Weight: This isn’t even a weighted randomizer so you can just do math.random(minWeight, maxWeight)
Create Tool: Scale the model to the weight of the fish (you can map this into a range with math.map()) and create the tool
Put into Backpack: Not much to talk about here, just put the tool into the backpack
When broken down this is all pretty basic stuff which you can find anywhere on the devforum.
since you know the minimum and maximum of said fishes (x Kg - y Kg)
you can do the same to their respective scales (j scale - k scale) based on their weight.
local min_weight = 5
local max_weight = 12
local min_scale = 1
local max_scale = 1.5
local function lerp(a, b, c)
return a + (b - a) * c
end
local get_fish -- fill this yourself
local rand = math.random() -- easier for system to calculate the random first
local get_weight = lerp(min_weight, max_weight, rand)
local get_scale = lerp(min_scale, max_scale, rand)
get_fish:SetAttribute("Weight", get_weight)
-- if the fish is a part
get_fish.Size *= get_scale
-- if the fish is a model
get_fish:ScaleTo(get_scale)
-- if the fish uses SpecialMesh
get_fish.SpecialMesh.Scale = Vector3.new(1, 1, 1) * get_scale
if you already got the system to calculate the weight, you can determine the size with the same configuration:
local get_weight -- lets say you already have this
local get_random = (get_weight - min_weight) / (max_weight - min_weight)
local get_scale = lerp(min_scale, max_scale, get_random) -- this works the same
just keep in mind you still need to adjust min and max weight and scale yourself,
this also works if random goes beyond 0 and 1