I have attempted to script an onTouch function of sorts that SHOULD make certain text labels in the GUI be visible at certain times. This does not seem to be working. I do not see any errors in the output or developer console, so I have no idea what is wrong with it.
local gui1 = game.StarterGui.Gui1.Frame function doSomethingOnTouch(part) local h = part.Parent:FindFirstChild("Humanoid") if h ~= nil then gui1.label1.Visible = true wait(3) gui1.label1.Visible = false wait() gui1.label2.Visible = true wait(3) gui1.label2.Visible = false end end script.Parent.Touched:connect(doSomethingOnTouch)
Sorry for the lack of explaining here, I don't have much time/
I don't have much time to explain, but I basically checked if the thing that touched it was a player by using the GetPlayerFromCharacter method.
After that, I made the gui1
variable which will actually change Visibility since it's the gui in the players playergui itself. That's pretty much all that needed to be done.
function ontouched(part) local hum = part.Parent:FindFirstChild("Humanoid") if hum and game.Players:GetPlayerFromCharacter(part.Parent) and hum.Health >0 then local gui1 = game.Players:GetPlayerFromCharacter(part.Parent):WaitForChild("PlayerGui"):WaitForChild("Gui1"):WaitForChild("Frame") gui1.label1.Visible = true wait(3) gui1.label1.Visible = false wait() gui1.label2.Visible = true wait(3) gui1.label2.Visible = false end end script.Parent.Touched:connect(ontouched)
lol and spikey you can do this
local Gui = script.Parent local Button = script.Parent.TextButton local Frame = script.Parent.Frame Open = false MouseButton1Down:connect(function(Open) if (Open == false) then do Open = true Button.Text = "Close" Frame.Visible = true elseif (Open == true) then do Open = false Button.Text = "Open" Frame.Visible = false
I'm not sure,try this though,
Make a ScreenGui with a Frame and Button and Local Script
The Button is what will Open/Close the gui The Frame is what will Open/Close
local Gui = script.Parent local Button = script.Parent.TextButton local Frame = script.Parent.Frame Open = false
MouseButton1Down:connect(function(Open)
if (Open == false) then do Open = true Button.Text = "Close" Frame.Visible = true
elseif (Open == true) then do Open = false Button.Text = "Open" Frame.Visible = false