So I am currently working on a project where I am going to have to be setting part’s properties locally. I could of course use a remote event in this orientation
--Server
RemoteEvent:FireClient(Player,Part, "CanCollide", false)
-- Client
RemoteEvent.OnClientEvent:Connect(function(Part, Command, Value)
if Command == "CanCollide" then
Part.CanCollide = Value
end
end)
This of course is a slow method and is very limited and inefficent if only want to set one part…
So what I am wondering is if there was a way that I can send a string such as…
"game.Workspace.Baseplate.Transparency = 1"
through a remote event parameter and have the client take that string and use it… I am aware there use to be LoadString but it was only on the Server and it is depreciated as well.
Your first example is not slow and is probably going to be the preferred way of doing it. The slowest part of that operation is at the network level, not the application level. In other words, you’re bottlenecked by how fast the network request goes from the server to the client (which I believe is throttled at 20hrz, but someone correct me otherwise).
You don’t ever want to be evaluating a string into code. It would be too tricky and too slow to parse it out, and too risky to use loadstring.
Now, if you have to set a bunch of parts at the same time, you could rewrite your remotes to handle an array of parts rather than just one:
--Server
RemoteEvent:FireClient(Player, {Part}, "CanCollide", false)
-- Client
RemoteEvent.OnClientEvent:Connect(function(Parts, Command, Value)
if Command == "CanCollide" then
for _,Part in pairs(Parts) do
Part.CanCollide = Value
end
end
end)