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

FilteringEnabled script and Remote Events really confusing me?

Asked by 7 years ago
Edited 7 years ago

So I'm trying to make a button that changes the player's GUI upon click, but whenever I attempt to do so, it comes up with weird errors that I have no clue to fix.

--Inside the button script

local function bag(player,row,column,free)
    if free.Value then
        workspace.RemoteEvents.BaggageGUI:FireServer(player,row,column);
        --free.Value = false
    end;    
end;

for i,v in pairs(script.PlaceBags:GetChildren()) do
    v.ClickDetector.MouseClick:connect(function(player)
        bag(player,v.Row.Value,v.Column.Value,v.Free);
    end);
end;

--Inside the ServerScriptService Script

game.Workspace.RemoteEvents.BaggageGUI.OnServerEvent:connect(function(player,row,column)    
    local playerg = game.Players[player.Name].PlayerGui;    
    local gui = playerg.Baggage.Container
    gui.Row.Text = tostring(row)
    gui.Column.Text = tostring(column)
end);

One of the recent errors I got was

10:19:11.247 - Workspace.MainFunctions.PlaceBag:4: bad argument #3 to 'Value' (string expected, got boolean)
10:19:11.248 - Stack Begin
10:19:11.249 - Script 'Workspace.MainFunctions.PlaceBag', Line 4 - upvalue bag
10:19:11.249 - Script 'Workspace.MainFunctions.PlaceBag', Line 10
10:19:11.249 - Stack End
0
for the 1st error where it says string expected, got boolean, it states that row.Value is either true or false. And tostring needs a string value. Pengdoo 26 — 7y
0
^ I'm not that stupid, I'm aware that I am using a string value. TheHospitalDev 1134 — 7y
0
What. 'tostring' doesn't need a string value, the whole point of 'tostring' is to transform a non-string value INTO a string. Link150 1355 — 7y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago

You seem to be sending a 'player' argument to the server. This is unnecessary, as the client is always the first argument passed. No need to pass it manually (:

So subsequently, your 'row' parameter on the server script is actually another player object.

LocalScript;

workspace.RemoteEvents.BaggageGUI:FireServer(row,column);
Ad

Answer this question