Hello, anyone know how to Textlabel text when this script has detected the word “Evasion”
Here’s the script:
` local EvasionCharge = 600`
local sentancebox = script.Parent.Parent.SentenceBox
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
if script.Parent.Text == "Evasion" then
end
end)
local TreasonCharge = 1000
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
if script.Parent.Text == "Treason" then
wait(1)
script.Parent.Parent.SentenceBox.Text = TreasonCharge
end
end)
---
local HighTreasonCharge = 1200
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
if script.Parent.Text == "High Treason" then
wait(1)
script.Parent.Parent.SentenceBox.Text = HighTreasonCharge
end
end)
You don’t have to keep checking for multiple events whenever you check for a TextProperty change, you could just encase it all in 1 event like so:
local TreasonCharge = 1000
local HighTreasonCharge = 1200
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
if script.Parent.Text == "High Treason" then
wait(1)
script.Parent.Parent.SentenceBox.Text = HighTreasonCharge
elseif script.Parent.Text == "Treason" then
wait(1)
script.Parent.Parent.SentenceBox.Text = TreasonCharge
end
end)