|
| 21 Jun 2012 08:48 AM |
Hi all. Some time ago, I made a simple plugin for ROBLOX studio. It's designed to make it easy to create teleport pads, and it does. However, it also has a strange and annoying side effect. Whenever I put it in the plugins folder, it causes a short, half-second freeze every few seconds (the screen freezes for this time, but the application seems to continue running, I.E camera and mouse keep moving etc). It doesn't sound like much, but it gets more frequent over time, and is really annoying. Does anyone know why this happens? The plugin script is shown below:
local tscr = Game:GetService("InsertService"):LoadAsset(62177156).Telescript local ts2 local deb = false local sw = false local part1 = nil local part2 = nil local box = Instance.new("SelectionBox") box.Color = BrickColor.new("Lime green") box.Transparency = 0.5 local box2 = box:clone() local sbox plug = PluginManager():CreatePlugin() local mouse = plug:GetMouse() button = plug:CreateToolbar("Utilities"):CreateButton("", "Two-click Teleport!", "Icon.png")
function awff() connection1:disconnect() connection2:disconnect() button:SetActive(false) box.Parent = nil box.Adornee = nil box2.Parent = nil box2.Adornee = nil part1 = nil part2 = nil end
plug.Deactivation:connect(function() sw = false awff() end)
function mousemove() if not sw then return end if not not part1 then sbox = box2 else sbox = box end if not mouse.Target then sbox.Parent = nil sbox.Adornee = nil return end sbox.Parent = Game.Workspace sbox.Adornee = mouse.Target if mouse.Target.BrickColor == BrickColor.new("Lime green") then sbox.Color = BrickColor.new("Magenta") else sbox.Color = BrickColor.new("Lime green") end end
function mouseclick() if deb then return end if not sw then return end if not mouse.Target then part1 = nil else if not part1 then part1 = mouse.Target elseif mouse.Target == part1 then deb = true part1 = nil box.Transparency = 1 box2.Parent = nil wait(0.3) box.Transparency = 0.5 deb = false else deb = true part2 = mouse.Target ts2 = tscr:clone() ts2.Parent = part1 ts2.Destination.Value = part2.Position + Vector3.new(0, 4, 0) ts2.Disabled = false ts2 = tscr:clone() ts2.Parent = part2 ts2.Destination.Value = part1.Position + Vector3.new(0, 4, 0) ts2.Disabled = false part1 = nil part2 = nil box.Transparency = 0 box2.Transparency = 0 wait(0.3) box.Transparency = 0.5 box2.Transparency = 0.5 box2.Parent = nil deb = false end end end
function reco1() return mouse.Button1Down:connect(mouseclick) end
function reco2() return mouse.Move:connect(mousemove) end
button.Click:connect(function() sw = not sw if sw then connection1 = reco1() connection2 = reco2() plug:Activate(false) button:SetActive(true) print("Activate!") else awff() print("Off!") end end)
Thanks in advance. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 08:50 AM |
EDIT: furthermore, I made a much simpler plugin for creating a baseplate quickly in blank places. This simpler plugin does not cause the same problem, and the script is as follows:
plug = PluginManager():CreatePlugin() button = plug:CreateToolbar("Utilities"):CreateButton("", "Click to make a baseplate", "Icon.png")
button.Click:connect(function() if Game.Workspace:FindFirstChild("Baseplate") ~= nil then return end local p = Instance.new("Part") p.Anchored = true p.Name = ("Baseplate") p.Material = ("Slate") p.FormFactor = ("Plate") p.BrickColor = BrickColor.new("Camo") p.Size = Vector3.new(256, 0.4, 256) p.CFrame = CFrame.new(Vector3.new(0, 0, 0)) p.Parent = Game.Workspace end)
|
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 21 Jun 2012 08:51 AM |
| It might be InsertService. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Jun 2012 08:59 AM |
| Possibly, but insert is only called once... |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 09:00 AM |
| If insert is the problem, how could I go about fixing it? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|