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

Remote Event not passing a parameter?

Asked by
Necrorave 560 Moderation Voter
8 years ago

I am having issues passing parameters to a remote event...

Here is the localscript:

player = script.Parent.Parent.Parent
backpack = player.Backpack

for i, v in pairs(script.Parent.Main:GetChildren()) do
    v.MouseButton1Up:connect(function () game.Workspace.ClonesRE:FireServer(v) end)
-- 'v' represents the textboxes the player is given to click on
end

Here is the Server script the event calls:

script.Parent.ClonesRE.OnServerEvent:connect(function (player, class)
-- 'v' is passed here as 'class'.  Although, it comes up as nil once it reaches here
    local backpack = player.Backpack
    --Clear backpack
    for i, v in pairs(backpack:GetChildren()) do v:remove() end
    --Enter new tools
    for i, v in pairs(class:GetChildren()) do
        if v:IsA("Tool") then
            v:Clone().Parent = backpack
        elseif v:IsA("HopperBin") then
            v:Clone().Parent = backpack
        end
    end
end)

Let me know if you need more details.

Thanks

1 answer

Log in to vote
4
Answered by 8 years ago

Server scripts cannot access PlayerGui with Filtering Enabled on :(. It won't error but the client doesn't replicate it to the server.

Instead of passing the instance try passing the name of it, or if you need more than just the name pass all the stuff you need from v in a table

Ad

Answer this question