Hello. I have three scripts, a local, server, and module script. The module script is in replicated storage and that is where I keep the player data. The local script is where the player inputs the data through buttons. The server script is where I combine everything together.
In the server script, I want to see if there's data in fluff1. If not, then it will insert the new data into fluff1. If there is data in fluff1, then it will insert the data into fluff2.
For some reason, it keeps saying "attempt to index nil with 'FluffName" at line 10 in the server script.
Module Script
local module = {}
module.FluffInventory = {
Fluff1 = {
BodyType = (""),
BodyColor = (""),
FluffName = (""),
FluffGender = (""),
FluffDescription = ("")
},
Fluff2 = {
BodyType = (""),
BodyColor = (""),
FluffName = (""),
FluffGender = (""),
FluffDescription = ("")
}
}
return module
Local Script
local CurrentFluff = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = {""},
FluffName = (""),
FluffGender = (""),
FluffDescription = ("")
}
CurrentFluff.BodyType = "Spots"
CurrentFluff.FluffName = "brian"
CurrentFluff.FluffGender = "male"
game.ReplicatedStorage.Remotes.CloneFluff:FireServer(CurrentFluff)
Server Script
local DataModule = require(game.ReplicatedStorage.Scripts.DataModule)
Remotes.CloneFluff.OnServerEvent:Connect(function(player, NewFluff)
local FindExistingFluffs = workspace.Fluffs:FindFirstChild(player.Name .. "'s Fluff")
if FindExistingFluffs then
FindExistingFluffs:Destroy()
end
for x = 1, 2 do
if DataModule.FluffInventory["Fluff" .. 1].FluffName[1] == "" then
print("found empty slot")
DataModule.FluffInventory["Fluff" .. 1] = NewFluff
break
end
end
end)

1 comment
For the server script, line 10, if I remove the "[1]," it still says the same error.