How do I send an ObjectValue's Value using a RemoteFunction?
Asked by
8 years ago Edited 8 years ago
So I'm currently trying to send the Value of an ObjectValue using a RemoteFunction.
In a LocalScript:
1 | local store_item = game.ReplicatedStorage:WaitForChild( "Store_Item" ) |
2 | local selected_item = script.Parent.Edit:WaitForChild( "Selected_Item" ) |
3 | script.Parent.Edit.Inventory.MouseButton 1 Click:connect( function () |
4 | store_item:InvokeServer(selected_item.Value) |
In a Script:
1 | local store_item = game.ReplicatedStorage:WaitForChild( "Store_Item" ) |
2 | function store_item.OnServerInvoke(player, selected_Item) |
3 | local id = selected_Item:WaitForChild( "Item_ID" ).Value |
4 | local name = selected_Item:WaitForChild( "Item_Name" ).Value |
6 | selected_Item:Destroy() |
7 | player.PlayerGui.ScreenGui.AddSlot:Invoke(id, name) |
When I test in Play Solo, it work's fine. However in a Local Server it gives me the following error.
attempt to index local 'selected_item' (a nil value)
I'm not sure of the issue... any help is appreciated.