#Objective Script changing
1 messages · Page 1 of 1 (latest)
sure
thats the one that triggers if i interacted with it
local wash = false
local Prompt = script.Parent
print("variables done")
script.Parent.Triggered:Connect(function(plr)
if wash == false then
wash = true
print("Wash variable done")
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Explore the House"
Prompt:Destroy()
wait(15)
end
end
print("Text changed")
else
wash = false
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Wash Your Hands"
end
end
print("did wrong")
end
end)
and i wanna turn this into that it changes the objective when 15 seconds pass by
local Prompt = script.Parent
print("variables done")
script.Parent.Triggered:Connect(function(plr)
if wash == false then
wash = true
print("Wash variable done")
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Explore the House"
Prompt:Destroy()
wait(15)
end
end
print("Text changed")
else
wash = false
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Wash Your Hands"
end
end
print("did wrong")
end
end)```
looking over it
give me a sec
alr
** You are now Level 4! **
just use task.delay
** You are now Level 2! **
look at forums
local wash = false
local Prompt = script.Parent
print("variables done")
script.Parent.Triggered:Connect(function(plr)
if wash == false then
wash = true
print("Wash variable done")
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Explore the House"
Prompt:Destroy()
task.wait(15)
end
end
print("Text changed")
else
wash = false
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Wash Your Hands"
end
end
print("did wrong")
end
end)
this?
no
hold on
local Prompt = script.Parent
print("variables done")
Prompt.Triggered:Connect(function(plr)
if not wash then
wash = true
print("Wash variable done")
for _, player in pairs(game.Players:GetPlayers()) do
local plrgui = player:FindFirstChild("PlayerGui")
if plrgui and plrgui:FindFirstChild("Objective") and plrgui.Objective:FindFirstChild("TextUI") then
plrgui.Objective.TextUI.Text = "Objective: Explore the House"
end
end
Prompt:Destroy()
task.delay(15, function()
for _, player in pairs(game.Players:GetPlayers()) do
local plrgui = player:FindFirstChild("PlayerGui")
if plrgui and plrgui:FindFirstChild("Objective") and plrgui.Objective:FindFirstChild("TextUI") then
plrgui.Objective.TextUI.Text = "Objective: Wash Your Hands"
end
end
wash = false
print("Reset back to wash objective")
end)
print("Text changed")
else
print("Prompt already triggered. Waiting to reset...")
end
end)```
why are you making separate forum for same problem?
because you didn't respond
mb
wait for reply
my bad
if you're so impatient solve it yourself or be more lazier by using chatgpt
chatgpt isnt lazy imo not aslong as you're learning by it
im sorry, i won't do it again
but theres no text label