Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --//Variables
- local CoreGui = game:GetService("CoreGui")
- local RunService = game:GetService("RunService")
- local AnchorPoint = Vector2.new(0.5, 0.5)
- local Added = {}
- local AmountAdded = 0
- local Active = false
- local DescendantAdded
- local SavedActive = plugin:GetSetting("DefaultAnchorPoint_Plugin")
- if RunService:IsRunMode() then return end
- wait(1)
- --//Easier Updates
- NewUpdate = Instance.new("StringValue")
- NewUpdate.Name = "NewUpdate"
- NewUpdate.Value = "DefaultAnchorPoint_Plugin"
- NewUpdate.Parent = RunService
- --//DescendantAdded/DescendantRemoved
- function Enable()
- DescendantAdded = game.DescendantAdded:connect(function(Child)
- if Child:IsDescendantOf(CoreGui) then return end
- if (Child:IsA("GuiObject") and (not Added[Child])) then
- Added[Child] = {true}
- Child.AnchorPoint = AnchorPoint
- end
- end)
- end
- game.CoreGui.ChildAdded:connect(function(Child)
- if Child.Name == "NewUpdate" and Child.Parent == RunService and Child.Value == "DefaultAnchorPoint_Plugin" then --Validation checks for update
- DescendantAdded:Disconnect() --Stops code being messed up in new updates
- end
- end)
- NewUpdate:Destroy()
- local ToolBar = plugin:CreateToolbar("MiddleAnchorPoint")
- local Toggle = ToolBar:CreateButton("Middle AnchorPoint", "Toggle feature", "http://www.roblox.com/asset/?id=132402257")
- Toggle.Click:connect(function() --Toggle
- if Active ~= false then
- plugin:Activate(false)
- Toggle:SetActive(false)
- if DescendantAdded ~= nil then DescendantAdded:Disconnect() end
- Active = false
- plugin:SetSetting("DefaultAnchorPoint_Plugin", false)
- elseif Active ~= true then
- plugin:Activate(true)
- Toggle:SetActive(true)
- Enable()
- Active = true
- plugin:SetSetting("DefaultAnchorPoint_Plugin", true)
- end
- end)
- --//Save active setting | Save some time
- if SavedActive == nil or SavedActive == true then
- plugin:Activate(true)
- Toggle:SetActive(true)
- Enable()
- Active = true
- if SavedActive == nil then
- plugin:SetSetting("DefaultAnchorPoint_Plugin", true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement