Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

editig serverside workspace from a local script?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.