|
| 05 Jul 2017 09:20 PM |
So I have made a script where if you press e, it should tween up your gui and back down when you press it again, but it's not working. Why isn't it working?
Can you help me fix it... ------------------------------------------------------- wait() Player = game.Players.LocalPlayer Mouse = Player:GetMouse() local frame = gui.GarageControls gui = script.Parent local blur = Instance.new("BlurEffect", workspace.CurrentCamera) blur.Enabled = false Open = false
toggle = false
function PressE(key) if (key =="e") then if (Open == false) then Open = true blur.Enabled = true if toggle == false then ################################, 'Out', 'Bounce', 1) toggle = true elseif (Open == true) then Open = false blur.Enabled = false frame:TweenPosition(UDim2.new(0,80,0,250), 'Out', 'Bounce', 1) toggle = false end end end end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
Niveum
|
  |
| Joined: 15 Aug 2009 |
| Total Posts: 3437 |
|
|
| 05 Jul 2017 10:45 PM |
.. Are you connecting the function?
~ S P I C Y ~ |
|
|
| Report Abuse |
|
|
platin_m
|
  |
| Joined: 25 Jul 2016 |
| Total Posts: 169 |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 06 Jul 2017 01:32 AM |
| --conditions:Connect(functionName) |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jul 2017 08:16 AM |
VERY VERY VERY IMPORTANT NOTE : This type of button pressing scripts need to be "Local Scripts" And they need to be inside StarterPlayerScripts or StarterCharacterScripts, Also that will require from you to re-define the variables like gui = script.Parent because the gui is not the script's parent anymore after changing it's location.
Here is the script :
---------------------------------------------------------- wait() Player = game.Players.LocalPlayer Mouse = Player:GetMouse() local frame = gui.GarageControls gui = script.Parent local blur = Instance.new("BlurEffect", workspace.CurrentCamera) blur.Enabled = false Open = false
toggle = false
function PressE() if (Open == false) then Open = true blur.Enabled = true if toggle == false then ################################, 'Out', 'Bounce', 1) toggle = true elseif (Open == true) then Open = false blur.Enabled = false frame:TweenPosition(UDim2.new(0,80,0,250), 'Out', 'Bounce', 1) toggle = false end end end
game:GetService("ContextActionService"):BindAction("PressingE", PressE, true, "e") ---------------------------------------------------------- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 10:52 AM |
| Ok so now where do I put the gui at? Do I put it at StarterPlayerScripts? And do I keep the script inside GuiMain? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 07 Jul 2017 08:33 AM |
| Keep the Gui in StarterGui, but change the script into a Local Script and put it in StarterPlayerScripts or StarterCharacterScripts. |
|
|
| Report Abuse |
|
|
| |
|