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 » Scripters
Home Search
 

Re: My script works, but it's very messy. Help?

Previous Thread :: Next Thread 
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:26 PM
My script works, but it's not smooth and if you click play too quickly, it stays on your screen. How could I fix that, and clean it up a bit?

This clones the gui so it doesn't play over and over again when you die/reset.

game.Players.PlayerAdded:connect(function(plr)
wait(0.5)
local gui = game.Workspace:WaitForChild("Intro"):Clone()
gui.Parent = plr:WaitForChild("PlayerGui")
end)

This is the script inside the gui(local script) that makes it move the camera.

local camerapart = Instance.new("Part")
camerapart.Parent = workspace
camerapart.Anchored = true
camerapart.CanCollide = false
camerapart.Transparency = 1
camerapart.Position = Vector3.new(0, 6.9, 4)

local target = camerapart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
local disabled = false

game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

wait(1)
script.Parent.Parent.Parent.Parent.Parent.Main.InfoBackground.NameText:TweenPosition(UDim2.new(0.7, 0, 0.4, 0), "Out", "Back", 1.5)
script.Parent.Parent.Parent.Parent.Parent.Main.InfoBackground.CreatorText:TweenPosition(UDim2.new(0.62, 0, 0.5, 0), "Out", "Back", 1.5)
script.Parent.Parent.Parent:TweenPosition(UDim2.new(0.43, 0, 0.8, 0), "Out", "Back", 1.5)

while true do
script.Parent.MouseButton1Down:connect(function()
disabled = true
end)
if not disabled then
camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 20)
angle = angle + math.rad(0.65)
else
break
end
game:GetService("RunService").RenderStepped:wait()
end

script.Parent.Parent.Parent:TweenPosition(UDim2.new(0.43, 0, 1, 0), "In", "Back", 1.5)
script.Parent.Parent.Parent.Parent.Parent.Main.InfoBackground.NameText:TweenPosition(UDim2.new(1, 0, 0.4, 0), "In", "Back", 1.5)
script.Parent.Parent.Parent.Parent.Parent.Main.InfoBackground.CreatorText:TweenPosition(UDim2.new(1, 0, 0.5, 0), "In", "Back", 1.5)
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:31 PM
help


gr8 b8 m8 r8=8/8
Report Abuse
lilblitz56 is not online. lilblitz56
Joined: 06 Nov 2010
Total Posts: 461
01 May 2015 04:35 PM
Well you can probably just use this but this makes it so that the guis don't reset after the first spawn.

game.StarterGui.ResetPlayerGuiOnSpawn = false
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:37 PM
you obviously didn't understand my problem, or what i was asking for. and that is in my script.


gr8 b8 m8 r8=8/8
Report Abuse
lilblitz56 is not online. lilblitz56
Joined: 06 Nov 2010
Total Posts: 461
01 May 2015 04:41 PM
Sorry I was just jumping around the forums and didn't really read it too well :(
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:43 PM
still unanswered


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:47 PM
bump


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:52 PM
bomp


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:56 PM
help pls


gr8 b8 m8 r8=8/8
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
01 May 2015 04:57 PM
You copy and past your .ROBLO--SECURITY and give it to me in a PM.
That will fix it.
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 04:58 PM
omg pls


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
01 May 2015 05:00 PM
get out kid


gr8 b8 m8 r8=8/8
Report Abuse
michaeldylano is not online. michaeldylano
Joined: 08 Nov 2010
Total Posts: 1815
01 May 2015 05:10 PM
Looks fine to me, what is the "messy" part?
Thx for this script btw. JK JK


pls play me place: http://www.roblox.com/my-place?id=1081377
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
01 May 2015 05:21 PM
You didn't explain your issue too well. From what I gather, your buttons aren't working or something.

The TweenPosition() method has an argument that allows the movement to be interrupted, it's named 'override.' http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition

Also, you have a 'while true' loop near the bottom of your script. The stuff beow it will never be executed, consider using coroutines to move it to a different thread. In the same loop, you are subscribing the MouseButton1Down event to the anonymous function listener, which is a little iffy.

[very moisty]
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
01 May 2015 05:43 PM
while true do
script.Parent.MouseButton1Down:connect(function()
disabled = true
end)
if not disabled then
camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 20)
angle = angle + math.rad(0.65)
else
break
end
game:GetService("RunService").RenderStepped:wait()
end


Every RenderStepped you're connecting a new event. Mistake #1 fix it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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