I am having issues passing parameters to a remote event...
Here is the localscript:
1 | player = script.Parent.Parent.Parent |
2 | backpack = player.Backpack |
3 |
4 | for i, v in pairs (script.Parent.Main:GetChildren()) do |
5 | v.MouseButton 1 Up:connect( function () game.Workspace.ClonesRE:FireServer(v) end ) |
6 | -- 'v' represents the textboxes the player is given to click on |
7 | end |
Here is the Server script the event calls:
01 | script.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 |
14 | end ) |
Let me know if you need more details.
Thanks
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