I am working on an Objective system for my horror game I am working on and after dozens of attempts, I can't seem to get it to work.
So the game starts off perfectly fine and working with it informing you on what is going on and what your goals are, and then you head off, so how it is supposed to work is when you exit the house it is supposed to activate an Ontouched script to change the objective to guide the player to walk to a building, but the Ontouched script won't work and the text wont change for some reason.
Objectiveblock1 is the block you touch when you exit the house, cancollide is false, anchored is true, transparency is 1, and I'm trying to compress the entire objective system into this one script too, but I don't know what is going wrong...
Here is the script, I would appreciate some help.
wait(8) script.Parent.Text = ("Here is what is going on.") wait(4) script.Parent.Text = ("You just woke up") wait(4) script.Parent.Text = ("You had a very ominous dream, but you shrug it off.") wait(5.5) script.Parent.Text = ("And you cant wait to see your friends again!") wait(5) script.Parent.Text = ("So as you slowly woke up, you decided to head out.") wait(4) script.Parent.Text = ("Objective: Exit the house") game.Workspace.Blocker1.Parent = game.ReplicatedStorage function onTouched(part) game.StarterGui.ScreenGui.Frame.TextButton.Text = ("Objective: ") end game.Workspace.Objectiveblock1.Touched:connect(onTouched)
Everything works until line 14.
Thank you in advance.
assuming you're changing the text of the same button, you can change
game.StarterGui.ScreenGui.Frame.TextButton.Text = ("Objective: ") to be
script.Parent.Text = Objective: "
otherwise, if this is a localscript you can do
local player = game.Players.LocalPlayer -- at the top of the script player.PlayerGui.ScreenGui.Frame.TextButton.Text = "Objective: "
for future reference, StarterGui is only cloned into the player's PlayerGui when they spawn
for updates to actually appear, you have to edit the player's PlayerGui instead
also if this is on the server then you're doing something very wrong, as messing with guis on the server is kind of incredibly nasty and bad practice
if the server needs a client to update a gui, or the server needs information from a gui, you should use a RemoteEvent instead