Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect when someone has a place open in Roblox Studio when updating #1

Open
blinkybool opened this issue Aug 22, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@blinkybool
Copy link
Member

blinkybool commented Aug 22, 2022

I have the beginnings of a plugin that could help achieve this

local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")

local function addMe()
	local __IsEditing = ServerStorage:FindFirstChild("__IsEditing")

	if not __IsEditing then
		return
	end
	
	local Me = __IsEditing:FindFirstChild(Players.LocalPlayer.UserId)
	
	if Me then
		return
	end
	
	print("Adding "..Players.LocalPlayer.UserId.." to __IsEditing")
	
	Me = Instance.new("StringValue")
	Me.Name = Players.LocalPlayer.UserId
	Me.Value = Players.LocalPlayer.DisplayName
	Me.Parent = __IsEditing
end

local function removeMe()
	local __IsEditing = ServerStorage:FindFirstChild("__IsEditing")

	if not __IsEditing then
		return
	end
	
	local Me = __IsEditing:FindFirstChild(Players.LocalPlayer.UserId)

	while Me do
		print("Removing "..Players.LocalPlayer.UserId.." from __IsEditing")
		Me:Destroy()
		Me = __IsEditing:FindFirstChild(Players.LocalPlayer.UserId)
	end
end

addMe()

plugin.Unloading:Connect(function()
	removeMe()
end)

With this plugin installed, it puts a StringValue in the __IsEditing folder when you open a place in Roblox Studio, and intends to remove it when you leave by connecting to the plugin.Unloading event. Unfortunately I don't think it runs before Team Create makes the on-close-save.

If this plugin could trigger a save after writing/removing the StringValue, then we could detect this in remodel and inform the user trying to update packages.

Is there any other API or something clever we could do to achieve this? We want to know if anyone has the place open in studio, since they can potentially overwrite the update, and will not be aware that a new version has been published.

There is the presence API but idk exactly what we can get out of it.

@blinkybool blinkybool added the enhancement New feature or request label Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant