Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help with making the buttons change the GUI Text, can anyone help me?

I'm trying to make a button change the text of my TextLabel, but it's not working... :/ Does anyone know anything that could help the script?

--This is the turn on stage
function onClick(click) 
local speak = game.workspace.Speakers.Sounder2.music2
local click = script.Parent.Parent.ClickSound

click:Play()
wait(1)
speak:Play()
speak.Looped = true
game.StarterGui.GUI1.TEXT1.Text=("Alarm!")


end

script.Parent.MouseClick:connect(onClick)

--This is the Turn off Stage
function onClick(click) 
local speak = game.workspace.Speakers.Sounder2.music2

speak:Stop()
speak.Looped = false

local click = script.Parent.Parent.ClickSound

click:Play()

game.StarterGui.GUI1.TEXT1.Text=("Alarm Deactivated")
wait(1)
game.StarterGui.GUI1.TEXT1.Text=("System Normal")

	
	
end

script.Parent.MouseClick:connect(onClick)

6 comments

0

Put instead of game.StarterGui, a "game:GetService("Players").LocalPlayer.PlayerGui"

0

okay, i'll try that

0

Is this right? game:GetService("Players").LocalPlayer.PlayerGui.GUI1.TEXT1.Text=("Testing")

0

It does not work, but thanks for helping

0

What exactly isn't working? Does the text not change???

0

nope

2 answers

✓ Accepted answer

I'm gonna rewrite my whole thing.

First of all, I will publish a formatted version at bbzlazer.github.io/friends-hangout


DesiredToResign, here are the top five reasons why your game isn't working.

  1. Don't use too many toolbox models Explanation: You probably used too many roblox models. I can tell from your personality that it doesn't seem like you could build something like that. I can tell from your shift-to-sprint script that it was taken from the toolbox. The zoom was overlapping for me and the camaro in your game was probably taken from the toolbox, too, since cars are really hard to script.

How to fix: I can't fix this problem, cause I don't know which models you want to keep or not. It's only a problem when you use too much. I could tell from the camera zoom glitching.

  1. Organize Explanation: You didn't organize your parts and models into folders, so I didn't know what to do with it. It's really helpful to put things into folders and organize them, especially when you need others to review your code/place.

How to fix: It's easy to place. Make and name folders accordingly and put your models/parts into each folder. I could do that for you, but it's helpful when you do it yourself

2 comments

0

Alright I found out that when you reset, the text changes because the alarm is on, its all because that checkbox that says "ResetOnSpawn" Something like that, is there a way i can change it with a script without reseting my character?

0

Please try doing the things above. That would help me, a lot, since I'm working on another project.

This should work, make this whole script a local script

--This is the turn on stage
local plr = game.Players.LocalPlayer

function onClick(click) 
	local speak = workspace.Speakers.Sounder2.music2
	local click = script.Parent.Parent.ClickSound
	
	click:Play()
	wait(1)
	speak:Play()
	speak.Looped = true
	plr.PlayerGui.GUI1.TEXT1.Text=("Alarm!")


end

script.Parent.MouseClick:Connect(onClick)

--This is the Turn off Stage
local plr = game.Players.LocalPlayer

function onClick(click) 
	local speak = game.workspace.Speakers.Sounder2.music2
	
	speak:Stop()
	speak.Looped = false
	
	local click = script.Parent.Parent.ClickSound
	
	click:Play()
	
	plr.PlayerGui.GUI1.TEXT1.Text=("Alarm Deactivated")
	wait(1)
	plr.PlayerGui.GUI1.TEXT1.Text=("System Normal")



end

script.Parent.MouseClick:Connect(onClick)

2 comments

0

alright

0

It still does not work

This discussion is preserved as it was. New answers, comments, and votes are closed.