-
I want for the server script to pass over a table from the server to the client.
-
What I receive on the client is an empty table, with nothing inside of it, but on the server I receive a table full of stuff.
-
I initially discovered that I named the part of the module wrong, so I fixed that, but it’s still not doing anything.
The script is fully intended to make it so after someone presses a button on a gui, it will fire a remote which goes onto the server and puts a table onto a module script, which is meant to be able to be seen by both the client and the server.
Server script: (Passing the table onto the module script)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, variable)
if plr == game.ReplicatedStorage.Deli_Station.Customer.Value then
local findSubCreation = game.ReplicatedStorage.Deli_Station.Value:FindFirstChild("SubCreation")
if findSubCreation then
local required = require(findSubCreation)
required.Deli_Part = variable
print(variable, required.Deli_Part)
game.ReplicatedStorage.PleaseWait:Clone().Parent = plr.PlayerGui
game.ReplicatedStorage.Deli_Station.Value.PlayerGui.PleaseWait:Remove()
game.ReplicatedStorage.DeliDisplay:Clone().Parent = game.ReplicatedStorage.Deli_Station.Value.PlayerGui
script.Parent:Remove()
end
end
end)
Client script: (The script that is meant to look at the table through the module script, this script is created inside of the DeliDisplay gui)
local ComponentsModule = game.Players.LocalPlayer:FindFirstChild("SubCreation")
local Components = require(ComponentsModule)
local Deli = Components.Deli_Part
local Template = script.Parent.Needs.Holder.Template
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ComponentsSelected = {}
local HoverThing = game.ReplicatedStorage.DisplayType:Clone()
local function findHover()
local camera = workspace.CurrentCamera
local startPos = camera.CFrame.Position
local endPos = mouse.Hit.Position
local params = RaycastParams.new()
params.FilterDescendantsInstances = {workspace.Border, player.Character}
local direction = (endPos - startPos).Unit
local distance = (endPos - startPos).Magnitude
local result = workspace:Raycast(startPos, direction * distance, params)
return result
end
print(Components)
for i, v in pairs(Components) do
print(v, Components[i])
for variable, has in pairs(Components[i]) do
print(variable, has)
if has == true then
local Cloned = Template:Clone()
Cloned.Name = variable
Cloned.Text = variable
Cloned.Parent = script.Parent.Needs.Holder
Cloned.Visible = true
end
end
end
Template:Destroy()
local SizeY = 1 / (#script.Parent.Needs.Holder:GetChildren() - 1)
for i, v in pairs(script.Parent.Needs.Holder:GetChildren()) do
if v:IsA("TextLabel") then
v.Size = UDim2.new(v.Size.X.Scale, 0, SizeY, 0)
end
end
If you understand the issue, please let me know, it would be greatly appreciated.