This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.
You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m making a fishing game, and use this ModuleScript to add my fish to a folder in ReplicatedStorage.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fishes = ReplicatedStorage.Assets.Fishes
local FishMod = {}
FishMod.Places = {
["Starter Island"] = {
},
}
FishMod.Fishes = {
Mackerel = {
name = "Mackerel",
place = FishMod.Places["Starter Island"],
attributes = {
minWeight = {
name = "minWeight",
val = 275
},
maxWeight = {
name = "maxWeight",
val = 350
},
},
Salmon = {
name = "Salmon",
place = FishMod.Places["Starter Island"],
attributes = {
minWeight = {
name = "minWeight",
val = 1200
},
maxWeight = {
name = "minWeight",
val = 2300
}
},
}
}
}
function FishMod:CreateFishes()
for _, fish in pairs(FishMod.Fishes) do
if not Fishes:FindFirstChild(fish.name) then
local FishVal = Instance.new("StringValue")
FishVal.Name = fish.name
FishVal.Value = fish.name
for _, attribute in pairs(fish.attributes) do
local attrVal = Instance.new("NumberValue")
attrVal.Name = attribute.name
attrVal.Value = attribute.val
attrVal.Parent = FishVal
end
FishVal.Parent = Fishes
end
end
end
return FishMod
Yes, the function is being called in another script and the module has been required properly.
-
What is the issue? Include screenshots / videos if possible!
For some reason only one is being added, or only the first one is being added.
There are no errors in the output.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried rewriting the table instead of copy pasting the same fish and editing it.
Other Details:
The part of another script its being called from:
local function playerAdded(player: Player)
local character = player.Character or player.CharacterAdded:Wait()
local loaded = QueueLoader.Initialize(player)
if loaded then
FishMod:CreateFishes()
for _, rod in Rods:GetChildren() do
if rod:WaitForChild("OnStart").Value then
if player.Data.EquippedRod.Value ~= rod.Name then
player.Data.EquippedRod.Value = rod.Name
rod = rod:Clone()
rod.Parent = character
end
end
end
else
player:Kick("Modules failed to load")
end
end
Players.PlayerAdded:Connect(playerAdded)
I will be very grateful for anyone who can help me resolve the bug, thanks for reading.