when you click that image label a remote event is fired to the server with the player, the stuff thats created, etc.
Thats how I get the player.
The server code is this:
local ts = game:GetService(“TweenService”)
game.ReplicatedStorage:WaitForChild(“FabricatorEvent”).OnServerEvent:Connect(function(plr, cells, name, class)
if script.Parent.Name == plr.Name … “Fabricator” then
local model = game.ReplicatedStorage.FabricatorData.Classes:FindFirstChild(class).Models:FindFirstChild(name):Clone()
local classfolder = game.ReplicatedStorage.FabricatorData.Classes:FindFirstChild(class)
model:SetPrimaryPartCFrame(script.Parent.ObjectReference.CFrame * CFrame.Angles(0,0,math.rad(90)))
model.Parent = script.Parent.OnCreation
for i, cell in ipairs(cells) do
cell.Name = "EmptyCell"
cell.DataHolder.ItemImage.Image = ""
cell.DataHolder.ItemName.Text = ""
end
local modelparts = model:GetChildren()
local partcount = 0
local realparts = {}
local function gettime(fore)
local part = modelparts[fore]
if part then
if part:IsA("MeshPart") or part:IsA("Part") or part:IsA("Union") then
if model.PrimaryPart == part then
else
partcount += 1
table.insert(realparts, part)
end
end
end
end
table.foreach(modelparts, gettime)
gettime()
local timee = (2.7/partcount)/2
local ti = TweenInfo.new(
timee,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false
)
local lasers = script.Parent.Lasers:GetChildren()
for i, laser in ipairs(lasers) do
laser.Beam.Enabled = true
laser.LineForce.Enabled = true
end
local lid = script.Parent.Lid.Lid
lid.WeldConstraint1.Enabled = false
lid.WeldConstraint2.Enabled = false
lid.WeldConstraint3.Enabled = false
lid.WeldConstraint4.Enabled = false
script.Parent.Body.Print:Play()
for i, part in ipairs(realparts) do
wait(timee)
local tween = ts:Create(part, ti, {Transparency = 0})
tween:Play()
end
for i, laser in ipairs(lasers) do
laser.Beam.Enabled = false
laser.LineForce.Enabled = false
end
if classfolder:FindFirstChild("Tool") then
local tool = classfolder.Tool:FindFirstChild(model.Name)
tool.Parent = plr.Backpack
end
lid.WeldConstraint1.Enabled = true
lid.WeldConstraint2.Enabled = true
lid.WeldConstraint3.Enabled = true
lid.WeldConstraint4.Enabled = true
model:Destroy()
end