GUI text not changing

Hey, I’m pretty new to scripting and need help with this script. It should replace the placeholder text on my GUI but it doesn’t seem to. I’ve also tried to print what’s in the textlabel after it starts tweening and it says the correct thing, it just doesn’t appear.

local desc = script.Parent.Desc.Text
local title = script.Parent.TextLabel.Text

function ModeName()
	wait(5)
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 1 then
		desc = "Classic purge. Last one standing wins."
		title = "Classic (No Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 2 then
		desc = "Classic purge with an ice border. Last one standing wins, don't get caught in the ice."
		title = "Classic (Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 3 then
		desc = "Water will damage you over time. Last one standing wins."
		title = "Flood (No Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 4 then
		desc = "Water will damage you over time with an ice border. Last one standing wins, don't get caught in the ice."
		title = "Flood (Ice)"
	end
	script.Parent:TweenPosition(
		UDim2.new(0.5, -113,0.921, -62),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		0.5,
		false
	)
	wait(29)
	script.Parent:TweenPosition(
		UDim2.new(0.5, -113,0.921, 100),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		0.5,
		false
	)
end

game.ReplicatedStorage.OpenScene.OnClientEvent:Connect(ModeName)

Thanks!

Change that to this:

local desc = script.Parent.Desc
local title = script.Parent.TextLabel

What you were doing is assigning the text value to the variable you just created, so you’re just editing the variable instead of the actual text.

Change all your editing the text lines to this:

desc.Text = "Water will damage you over time with an ice border. Last one standing wins, don't get caught in the ice."

If you have any other questions let me know!

1 Like

Thanks! Stupid mistake on my part lol.

1 Like

Here is the full script:

local desc = script.Parent.Desc
local title = script.Parent.TextLabel

function ModeName()
	wait(5)
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 1 then
		desc.Text = "Classic purge. Last one standing wins."
		title.Text = "Classic (No Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 2 then
		desc.Text = "Classic purge with an ice border. Last one standing wins, don't get caught in the ice."
		title.Text = "Classic (Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 3 then
		desc.Text = "Water will damage you over time. Last one standing wins."
		title.Text = "Flood (No Ice)"
	end
	if script.Parent.Parent.Parent.PurgeMenu.ModeSelect.ModeSelect.Value == 4 then
		desc.Text = "Water will damage you over time with an ice border. Last one standing wins, don't get caught in the ice."
		title.Text = "Flood (Ice)"
	end
	script.Parent:TweenPosition(
		UDim2.new(0.5, -113,0.921, -62),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		0.5,
		false
	)
	wait(29)
	script.Parent:TweenPosition(
		UDim2.new(0.5, -113,0.921, 100),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		0.5,
		false
	)
end

game.ReplicatedStorage.OpenScene.OnClientEvent:Connect(ModeName)

I didn’t test the code, so it might have errors but you get the idea.

No problem :slight_smile: You’re just starting and it’s good to see you wanting to improve.