So I was working on my game and I wanted to make a RemoteEvent that would pass multiple variables, so I just made it pass an array.

Server Side:

while createdBicycles ~= 3 do
    wait() -- This right here fixed everything
    local bicycle = bicycles.Bicycle:Clone()
    bicycle.Parent = bicycles
    createdBicycles = createdBicycles + 1
    bicycle.Name = "Bicycle" .. createdBicycles
    local configuration = bicycle:WaitForChild("Configuration")
    local random1 = math.random(3, 20) * 5
    local random2 = math.random(1, 3)
    configuration.TheName.Value = "(Bicycle name)"
    configuration.Price.Value = random1
    if random2 == 1 then
        configuration.Used.Value = "Yes"
        configuration.Price.Value = configuration.Price.Value - 5
    else
        configuration.Used.Value = "No"
    end 
    configuration.Type.Value = "Classic"
    local configArray = {
    createdBicycles,
    configuration.TheName.Value,
    configuration.Price.Value,
    configuration.Used.Value,
    configuration.Type.Value }
    bicycleSpawnEvent:FireAllClients(configArray)
    print("Event sent")
end

Client Side:

bicycleSpawnEvent.OnClientEvent:Connect(function(config)
    print("Event received")
    print(unpack(config))
    print(gui.BicyclesTab["BicycleName" .. tostring(config[1])])
    gui.BicyclesTab["BicycleName" .. tostring(config[1])].Text = tostring(config[2])
    print(gui.BicyclesTab["BicycleName" .. tostring(config[1])].Text)
    gui.BicyclesTab["BicyclePrice" .. tostring(config[1]) .. "N"].Text = tostring(config[3]) .. "$"
    gui.BicyclesTab["BicycleUsed" .. tostring(config[1])].Text = "Used: " .. tostring(config[4])
    gui.BicyclesTab["BicycleType" .. tostring(config[1])].Text = "Type: " .. tostring(config[5])
end)

It doesn't do anything. All the text remains default. There are no errors either.

Everything is defined, I just didn't type it so the you wouldn't need to read long

I hope somebody can help me.

EDIT: I placed some print()s (see above) and what I get in my console is:

Event sent

But when I placed some breakpoints on line 10 and 11 on the Server Side it shows:

Event sent

Event received

1 (Bicycle name) 20 No Classic

BicycleName1

(Bicycle name)

Breakpoints seem to fix the script. It's pretty weird.

EDIT: I added a single wait().

3 comments

1

Make sure the client can access it, meaning it's not in ServerStorage

0

client side you've got "config" not "configArray", was that a typo?

0

What you name your variables makes no difference as to the content.