generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Plugin causing short freezes

Previous Thread :: Next Thread 
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
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
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
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 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
21 Jun 2012 08:51 AM
It might be InsertService.
Report Abuse
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
21 Jun 2012 08:58 AM
InsertService is broken.
Report Abuse
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
21 Jun 2012 08:59 AM
Possibly, but insert is only called once...
Report Abuse
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
21 Jun 2012 09:00 AM
If insert is the problem, how could I go about fixing it?
Report Abuse
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
21 Jun 2012 02:06 PM
Bump
Report Abuse
Elektromag is not online. Elektromag
Joined: 10 May 2009
Total Posts: 1206
22 Jun 2012 10:22 AM
More bump
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
22 Jun 2012 10:26 AM
Bump for u
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image