Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script says a string doesn't exist, even though it does?

Asked by 3 years ago
Edited 3 years ago

Hi, I have a problem with my table. I am firing a RemoteEvent with a string. My other script receives the string and if the string is in the table then the script will work. If not, it will print that the string does not exist. So it prints that the string does not exist, but it does?

Script 1:

        local ReplicatedStorage = game:GetService("ReplicatedStorage")

        local Events = ReplicatedStorage:WaitForChild("Events")

        local ServerEvents = Events:WaitForChild("ServerEvents")

        local RemoteEvent = ServerEvents:WaitForChild("LoadRobbery")

        local Robbery = "ImpossibleJewelry"

        RemoteEvent:FireServer(Player, Robbery)

Script 2:

RemoteEvent.OnServerEvent:Connect(function(Player, Robbery)

    local AvailableRobberies = {"ImpossibleJewelry"}

    if table.find(AvailableRobberies, Robbery) then

        print("Result")

    else

        print("The robbery name does not exist!")
    end
end)

1 answer

Log in to vote
1
Answered by 3 years ago
RemoteEvent:FireServer(Robbery)
0
Legend Bankrovers 226 — 3y
Ad

Answer this question