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

editig serverside workspace from a local script?

Asked by
caiggg 5
2 years ago
local input = script.Parent.TEXT2

script.Parent.BOX2.MouseButton1Click:Connect(function()
    game.Workspace.BOX2.SurfaceGui.TextLabel.Text = input.Text



end)

how can i intergrate this with replicated storage and events so i can edit server workspace instead of client workspace

1 answer

Log in to vote
0
Answered by
Cirillix 110
2 years ago

By using a remote event. Remote events are used to safely transfer data from client to server/server to client. Do this :

Client script

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local input = script.Parent.TEXT2

script.Parent.BOX2.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer(input.Text)   
end)

Server script

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent.OnServerEvent:Connect(function(player, text)
    game.Workspace.BOX2.SurfaceGui.TextLabel.Text = input.Text
end)

Now, you can name your remote events to know which one is associated to something specifc. For exemple, you could name this one "BoxText".

For more information : Remote Functions and Events

Ad

Answer this question