I'm trying to use a module script to create a crate with a specific item, and when i try to pass 4 values (string contents, int amount, string owner, Vector3 position), each value moves up one position, and an empty table replaces the first value (table contents, string amount, int owner, string position). The two scripts are a local inventory button script (with error at line 4)
Player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:connect(function()
local crate = require(game.ReplicatedStorage.CrateModule)
crate:Create("Test", 1, "Test", workspace.SpawnLocation.Position + Vector3.new(0,5,0)) --somehow becomes (empty table, "Test", 1, "Test")
Player.Inventory:FindFirstChild(script.Parent.Text):Destroy()
script.Parent.Parent.Parent.RefreshList.Disabled = false
end)
and the module script (with error at line 4)
local Crate = {}
function Crate.Create(contents, amount, owner, position)
local crate = game.ReplicatedStorage.Crate:Clone()
crate.Configuration.Contents.Value = contents --throws "bad argument #3 to 'Value' (string expected, got table)"
crate.Configuration.Amount.Value = amount
crate.Configuration.Owner.Value = owner
crate.Position = position
crate.Parent = workspace
local sscript = game.ReplicatedStorage.CrateScript:Clone()
sscript.Parent = crate
sscript.Disabled = false
end
return Crate
