What arguments does your CreateFolders
functions take in?
-- Create Folders of cars
local function CreateFolders(cardata,player:Player)
local OwnedCarsFolder = player:FindFirstChild("OwnedCars")
if not OwnedCarsFolder then
OwnedCarsFolder = Instance.new("Folder",player)
end
OwnedCarsFolder.Name = "OwnedCars"
for i,v in cardata do
local CarDataFolder = Instance.new("Folder",OwnedCarsFolder)
CarDataFolder.Name = tostring(i)
if v.Limited and v.Limited == true then
local LimitedSerial = Instance.new("NumberValue",CarDataFolder)
LimitedSerial.Value = v.SerialValue
LimitedSerial.Name = "Serial"
end
if v.Offsale and v.Offsale == true then
local OffSale = Instance.new("BoolValue",CarDataFolder)
OffSale.Value = true
OffSale.Name = "OffSale"
end
if v.Price then
local Price = Instance.new("NumberValue",CarDataFolder)
Price.Value = v.Price
Price.Name = "Price"
end
end
end
Running my code in game return no error or warning only the luau solver shows warning
what does it say if you hover over the data
Also sorry but this is clearly an issue look:
Oh, that makes sense, it just tries to use the non existing variables in the dictionary inside the function.
Your dictionary has only the {Offsale = true}
key, but nothing to do with Limited
, SerialValue
and so on.
Same story as :WaitForChild()
Cant use methods on the objects that might be nil
For example
if you use game.Players.LocalPlayer
on the server it will return nil, because there is no such thing as LocalPlayer on server, but if you do that on client it will return your player instance.
If you want to get rid of that warning, use type declaration or type casting, like i showed you with RemoteEvents
you dont have to specify the type of the ReplicatedStorage
Luau thinks that you are using it as class/type, but not as the actual game object that is used in the Explorer
Oh also, take the note.
Never do that to deal with exploiters, it takes them nothing to create a new account and figure out whats a problem, instead delay their punishment by a week or more, so they will remain clueless why that happened.
oh also, in case you wondered.
--!strict
doesnt magically optimize your code, it just forces you to follow declarative programming paradigm, just like C++ or Rust.