I have a difficulty chart game, i wanted a script that changes the text on a textlabel depending on what stage your own, so like theres a grey stage, a green stage, an orange stage, and a red one. how could i make this work?, i tried a script, but it didnt seem to work. Heres the code:
local stage1 = game.Workspace.Stage1
local stage2 = game.Workspace.Stage2
local stage3 = game.Workspace.Stage3
local stage4 = game.Workspace.Stage4
local stageText = game.StarterGui.StageLabel.TextLabel
stage1.touched:Connect(function(changetext)
local humanoid = changetext.Parent:FindFirstChild("Humanoid")
if humanoid then
stageText.Text = "Stage 1, beginner."
end
end)
stage2.touched:Connect(function(changetext)
local humanoid = changetext.Parent:FindFirstChild("Humanoid")
if humanoid then
stageText.Text = "Stage 2, Intermediate."
end
end)
local stageText = game.StarterGui.StageLabel.TextLabel
stage3.touched:Connect(function(changetext)
local humanoid = changetext.Parent:FindFirstChild("Humanoid")
if humanoid then
stageText.Text = "Stage 3, Hard."
end
end)
stage4.touched:Connect(function(changetext)
local humanoid = changetext.Parent:FindFirstChild("Humanoid")
if humanoid then
stageText.Text = "Stage 4, Insane."
end
end)
Also, this is a local script inside of starter player scripts.