here is my code, I get no errors in output.
local touched = false
local function onTouch(hit)
end
workspace.indicator1.Touched:Connect(onTouch)
local function onTouch(hit)
if (touched == false) then
touched = true
if game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled ~= true then
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled = true
setText("Hello!")
end
end
end
end
workspace.indicator1.Touched:Connect(onTouch)
I really don't know why it wouldn't work, but basically I am trying to make it so when you touch the block, the gui shows and the text of the gui changes to "Hello!" then the gui will disappear (didn't add that yet!) and when you touch the block again, the gui won't come up and nothing will happen. I only want it to occur once. any help will be appreciated I have been trying to figure it out for days now, and I am new to coding so sorry if this is a dumb question thank you!

3 comments
Thank you for your answer! And that's my bad, I most likely did that during editing the coding over and over again. I also got the error in the output, "Expected ')' (to close '(' at line 36), got 'end'" I'm not sure what I would change but thank you!
Fixed
thank you so much, that worked, but after 3 seconds i can touch it and the gui will come up. if I make the delay a really high number, would that work so the player would move on by the time the times up? thank you!