Unanchor Owner Gui

Basically, i’m trying to make an owner gui that unanchors everything in the game. I got the owner only part working, but the unanchor is still local.
I’ve been researching RemoteEvents, but I still can’t figure this out.


local remoteEvent = ReplicatedStorage:WaitForChild("Unanchor")

function onClicked()
	a = function(instance)
		for i,v in pairs(instance:GetChildren()) do
			if v.className == "Part" then
				v.Anchored = false
			end
			a(v)
		end
	end
	a(workspace)
end
script.Parent.MouseButton1Down:connect(onClicked)
remoteEvent:FireAllClients(onClicked)```
(Yes there is a remote event in replicated storage)
1 Like

make everything unanchor on the serverside, so it appears for everyone, and everyone that newly joins.

Fire the event when the person has clicked the button, and then unanchor all the parts on the server.

like this?


local remoteEvent = ReplicatedStorage:WaitForChild("Unanchor")

function onClicked()
	remoteEvent:FireAllClients(onClicked)
	a = function(instance)
		for i,v in pairs(instance:GetChildren()) do
			if v.className == "Part" then
				v.Anchored = false
			end
			a(v)
		end
	end
	a(workspace)
end
script.Parent.MouseButton1Down:connect(onClicked)

Don’t fire all clients. Just fireserver and then on the server unanchor all the parts.

1 Like

local remoteEvent = ReplicatedStorage:WaitForChild("Unanchor")

function onClicked()
	remoteEvent:FireServer(onClicked)
	a = function(instance)
		for i,v in pairs(instance:GetChildren()) do
			if v.className == "Part" then
				v.Anchored = false
			end
			a(v)
		end
	end
	a(workspace)
end
script.Parent.MouseButton1Down:connect(onClicked)
``` this work?
script.Parent.MouseButton1Down:connect(function()

end)

– local script

script.Parent.MouseButton1Down:connect(function()
remoteEvent:FireServer(game.Players.LocalPlayer)
end)

–Server script

remoteEvent.OnServerEvent:Connect(function(Player)
--Unanchor all parts here
end)

I’m very confused, is a server script a module?

No just a normal script inside ServerScriptService.