When I add new item to replicated storage as client, I need to show this change at server, if it is possible, only in 1 folder.
Thx
Try using a Remote Event and sending the data needed to the server.
Client Script:
DemoEvent:FireServer(data)
Server:
DemoEvent.OnServerEvent:Connect(function(data)
print(data) -- the server will receive the data
end)
Here is more info on how: Custom Events and Callbacks | Documentation - Roblox Creator Hub
Sorry I edited my post with some examples for you.
I know how it work, but I was asking if there is any easier, also can be less safer(its 1player place).
Why do you need it to be put there by the client?
I have furniture place system with 2 folders 1)all models and 2) selected models and the user clone models from 1st folder to 2nd folder and I am asking if there is some easy way to apply all changes at replicated storage at client to server.
Only way I know is remote event(harder) or select the items not from second folder (selected), but from first folder (all), but this also isn’t easy
You should probably handle mostly all of it on the server to ensure the player doesn’t exploit. If an exploiter moves a model into selected and your handling this on the client can’t they just place down any item they would like?
If your not sure then just use a RemoteEvent to the server and send the data of the selected items then check if they exist in your folder with all the models, if they do then you can allow them to place it.
The exploiting here is no problem, because cash lowering does server, so it really can be very un safe in this operation. (The selection file is only what furniture or set of furniture (more furniture models switched by e) so it’s like in real shop: you can buy enything if you have money for it)
Yes however an exploiter could put in an object they do not own.
You could fire a remoteevent with a “request” and check if it is already there and if they own it.
local Folder = --
local Remote = --
Remote.OnInvoke = function(Player, Args)
local Object = Args[1]
local MyOwnedFolders = Player.OwnedFurniture
if not Folder:FindFirstChild(Object) and MyOwnedFolders:FindFirstChild(Object) then
-- Handle
end
end
You should probably add itemCodes instead so you can add multiple. As others have said, don’t let the client manipulate any decisions as you should always go into mind the information they send has been tampered with.
The psuedo-code above is probably not going to help in terms of copying n pasting into your script but it gives you the general idea of what you should be checking for.
I solved it with method 2, but thx for answering my question.
This is imposible to exploit even with premision to edit the selection folder because this contain only what they selected to build and this can be done in gui, to hack furniture you need to add it into workspace, into folder for it