Skip to content

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

@blinkybool

Description

@blinkybool

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions