Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago
Edited 5 years ago

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)
0
Put instead of game.StarterGui, a "game:GetService("Players").LocalPlayer.PlayerGui" AswormeDorijan111 531 — 5y
0
okay, i'll try that DesiredToResign 10 — 5y
0
Is this right? game:GetService("Players").LocalPlayer.PlayerGui.GUI1.TEXT1.Text=("Testing") DesiredToResign 10 — 5y
0
It does not work, but thanks for helping DesiredToResign 10 — 5y
View all comments (2 more)
0
What exactly isn't working? Does the text not change??? User#30567 0 — 5y
0
nope DesiredToResign 10 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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

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? DesiredToResign 10 — 5y
0
Please try doing the things above. That would help me, a lot, since I'm working on another project. User#30567 0 — 5y
Ad
Log in to vote
0
Answered by
0_2k 496 Moderation Voter
5 years ago
Edited 5 years ago

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)
0
alright DesiredToResign 10 — 5y
0
It still does not work DesiredToResign 10 — 5y

Answer this question