|
| 21 Jul 2015 12:07 AM |
I made a gui with 3 text buttons and whenever I hover over them or click on them they don't change color or do what I want them to do. Could anyone help please? Here is the structure: ScreenGui localscript StartScreen(frame) Frame About(textbutton) Customize(textbutton) Play(textbutton)
Here is my script: --colors blue >stroke 0, 181, 181 >text 0, 191, 191 --colors red >stroke 85, 17, 29 >text 255, 0, 0 local gui = script.Parent.StartScreen Player = game.Players.LocalPlayer wait(1) ----------------------------Play----------------------------- function hoverPlay() gui.Play.TextColor3 = Color3.new(255, 0, 0) gui.Play.TextStrokeColor3 = Color3.new(85, 17, 29) end
function unhoverPlay() gui.Play.TextColor3 = Color3.new(0, 191, 191) gui.Play.TextStrokeColor3 = Color3.new(0, 181, 181) end
function Play() print("Click!") local Torso = Player.Character:FindFirstChild("Torso") if Torso ~= nil then Player.Character.Torso.CFrame = CFrame.new(0, 1000000, 0) wait(0.01) script.Parent:Destroy() wait(0.01) workspace.CurrentCamera:Destroy() wait(0.01) Torso:Destroy() end end
--------------------------Customize-------------------------- function hoverCustomize() gui.Customize.TextColor3 = Color3.new(255, 0, 0) gui.Customize.TextStrokeColor3 = Color3.new(85, 17, 29) end
function unhoverCustomize() gui.Customize.TextColor3 = Color3.new(0, 191, 191) gui.Customize.TextStrokeColor3 = Color3.new(0, 181, 181) end
function Custom() print("Click!") if gui.Parent.Customize.Visible == true then gui.Parent.Customize.Visible = false else gui.Parent.Customize.Visible = true end end ----------------------------About---------------------------- function hoverAbout() gui.About.TextColor3 = Color3.new(255, 0, 0) gui.About.TextStrokeColor3 = Color3.new(85, 17, 29) end
function unhoverAbout() gui.About.TextColor3 = Color3.new(0, 191, 191) gui.About.TextStrokeColor3 = Color3.new(0, 181, 181) end
function About() print("Click!") if gui.Frame.Visible == true then gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position - UDim2.new(0.2, 0, 0, 0) wait(0.001) gui.Frame.Visible = false else gui.Frame.Visible = true gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.1, 0, 0, 0) wait(0.001) gui.Frame.Position = gui.Frame.Position + UDim2.new(0.2, 0, 0, 0) wait(3) end end
gui.Play.MouseEnter:connect(hoverPlay) gui.Play.MouseLeave:connect(unhoverPlay) gui.Play.MouseButton1Down:connect(Play)
gui.Customize.MouseEnter:connect(hoverCustomize) gui.Customize.MouseLeave:connect(unhoverCustomize) gui.Customize.MouseButton1Down:connect(Custom)
gui.About.MouseEnter:connect(hoverAbout) gui.About.MouseLeave:connect(unhoverAbout) gui.About.MouseButton1Down:connect(About)
|
|
|
| Report Abuse |
|
|
| 21 Jul 2015 12:08 AM |
| Sorry forgot to add this but they work when I use play in Roblox studio but they don't work in a server. |
|
|
| Report Abuse |
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 21 Jul 2015 12:15 AM |
| I suggest using Setup Modulescripts for each one instead of a large messy script |
|
|
| Report Abuse |
|
|
| 21 Jul 2015 12:58 AM |
| I made module scripts for each one of my functions and disabled my original local script.I still have the same problem.The buttons will work in play solo but not in a server. |
|
|
| Report Abuse |
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 21 Jul 2015 09:31 PM |
| What about when you start a Test with at least 1 Player in Studio? |
|
|
| Report Abuse |
|
|
| 21 Jul 2015 09:40 PM |
| That's when it does not work, although it will work in play solo |
|
|
| Report Abuse |
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 21 Jul 2015 09:57 PM |
function Custom() print("Click!") if gui.Frame.Customize.Visible == true then gui.Frame.Customize.Visible = false else gui.Frame.Customize.Visible = true end end
There is no such button. If you meant gui.Customize, if it's not Visible, you can't click it. |
|
|
| Report Abuse |
|
|
| 21 Jul 2015 09:59 PM |
While testing it in a server I noticed that I started to get this error 19:54:24.093 - StartScreen is not a valid member of ScreenGui 19:54:24.093 - Script 'Players.Player1.PlayerGui.StartGui.Buttons', Line 3 19:54:24.093 - Stack End
I don't really know why this error is popping up since the frame named StartScreen is inside of my screengui. Also I don't know if this might be why but I have all of my gui's inside of replicatedStorage and duplicate them into the local player. |
|
|
| Report Abuse |
|
|
| 21 Jul 2015 11:52 PM |
| Alrighty, I ended up fixing it by adding a wait at the very beginning of the script. Based off the error I was getting I thought the script might be trying to load before the gui was duplicated into the players gui. Thanks for your help guys. |
|
|
| Report Abuse |
|