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
9 years ago

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

Here is the localscript:

1player = script.Parent.Parent.Parent
2backpack = player.Backpack
3 
4for i, v in pairs(script.Parent.Main:GetChildren()) do
5    v.MouseButton1Up:connect(function () game.Workspace.ClonesRE:FireServer(v) end)
6-- 'v' represents the textboxes the player is given to click on
7end

Here is the Server script the event calls:

01script.Parent.ClonesRE.OnServerEvent:connect(function (player, class)
02-- 'v' is passed here as 'class'.  Although, it comes up as nil once it reaches here
03    local backpack = player.Backpack
04    --Clear backpack
05    for i, v in pairs(backpack:GetChildren()) do v:remove() end
06    --Enter new tools
07    for i, v in pairs(class:GetChildren()) do
08        if v:IsA("Tool") then
09            v:Clone().Parent = backpack
10        elseif v:IsA("HopperBin") then
11            v:Clone().Parent = backpack
12        end
13    end
14end)

Let me know if you need more details.

Thanks

1 answer

Log in to vote
4
Answered by 9 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