#Objective script not working
1 messages · Page 1 of 1 (latest)
did you correct this typo
let me do it rq
i fixed it and its still not working
wait
alr
you are referencing startergui, use (playerhere).PlayerGui
let me try
to get the player i recommend you using a local script, however, you can reference to the plr via the triggered func
so do i type the player user in (playrhere)?
no
question
where r you running this script
client or server
i mean the script
you mean if its local script or not?
yeah
its not local
oh well then
reference the plr via the func, you should give the player an instance bool value so it doesnt trigger different because a previous player alr activated it
alr lemme try
you can give the boolvalue with a playeradded func
by that you can replace the wash value
playergui is alr automatic
k
(plrinstance).PlayerGui
and it has the same stuff like startergui (unless you add specific guis to some players)
can you like explain it more idiot friendly?
** You are now Level 2! **
explain more idiotfriendly?
ok basically you have this bowl of fruits, which containst your guis, when a player joins, this bowl of fruits gets cloned in another location called playergui, which is what you see on your screen by client, this bowl of fruitsis cloned to every player, however this apple can be changed by some scripts if you wish to, like adding a pear (another screen gui) or etc
the bowl of fruits is located on the player
(Btw same for PlayerScripts too)
you might not understand what to do, and i dont think have the enough time to explain since sleep but
this is how my script looks like now
local TextUI = game.StarterGui.Objective.TextUI
local Text = TextUI.Text
local wash = false
print("variables done")
script.Parent.Triggered:Connect(function(plr)
if wash == false then
wash = true
print("Wash variable done")
Text = ("Objective: Explore the House")
print("Text changed")
else
wash = false
Text = ("Objective: Wash Your Hands")
print("did wrong")
end
end)
basically what your script is doing is changing a value, but this value can be changed by everyone anytime, however the value is always the same for everyone, causing it to show different texts on screen on activated
example
noob1 activates it and gets the normal message
and the proximityprompt text is changed
oh yeah
forgot
however
noob2 activates it again
but he gets the other message and gets confused
since the old value was still there
i dont know if you want that to happen
ohhh
but yeah
so how do i do it now that it works for both players. Like changes on both screens when one activates it
you want it to change for everyone?
or be for the only player who activates it
wait, so you mean like, someone activates it, and the message gets changed to everyone's screen?
right
yea
okay
** You are now Level 11! **
you can try gettting the children with a loop
for i,plr in pairs(game.Players:GetChildren() do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
end
end
this gets the players in the current server at time
oh wait
ok done
playergui is just like starter gui
so do i put it in the script that is the child of the proximity prompt?
or just a new script in server script service
nope
red = delete
blue = replace
replace those lines with the loop i gave you
without the end right?
but then its end and the text underneath doesn't run
ok hold on
can you give me your current script
sure
local TextUI = game.StarterGui.Objective.TextUI
local Text = TextUI.Text
local wash = false
print("variables done")
script.Parent.Triggered:Connect(function(plr)
if wash == false then
wash = true
print("Wash variable done")
Text = ("Objective: Explore the House")
print("Text changed")
else
wash = false
Text = ("Objective: Wash Your Hands")
print("did wrong")
end
end)
ping me when your finished
local wash = false
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"
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 should wokr
@proud haven
however
yea`?
this is for the current players in time
so if a player joins
after the function happened
the message wont be shown
i can help with that too but
so what if one player's got a potato pc and takes time to load in?
going to sleep rn
alr, when your awake again u can dm me
i would recommend showing console or output
also i might've made a typo since
l
** You are now Level 3! **
*k
i made that script on note blocks
or i can screenshare
i cant rn
also gn
alr
cya
Close the bracket
at do?
pairs
this the script
local wash = false
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"
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)
im a new and not good dev 😭
Line 8, you're not closing the bracket in pairs. This means you're missing the ")" or "(".
** You are now Level 7! **
infront of it
Infront of do
) do
another one of it is missing, find it
the other do?
and how do i do it that the objective changes to "Objective: Go Outside" in 15 seconds?
find textlabel and change their text property
just like what you wrote plrgui.Objective.TextUI.Text = "Objective: Explore the House"
so i replace the textlabel with plrgui.Objective.TextUI.Text = "Objective: Explore the House"
`?
Yes
@proud haven Textlabel is the original name for the object itself, the name can be changed
yeah
whats the need for replacing
you said i should replace it with plrgui.Objective.TextUI.Text = "Objective: Explore the House"
i never said replace
u said change
oh
i mean like
in the script that it changes
not that i change it manually
because if i would change it manually it would already be at the start
and i want it after the "explore the house"
you're changing the text property of the textlabel
yeah
find the textlabel, get text property and set it to = "Objective: whatever"
in the script?
yes
i mean like
here
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)
where should i replace it
because i need the objective things for the start
only after the task.wait i want to change the textr
print("variables done") ?? 
...
you dont need debugging for variables
so not for those i saw there
what is script.Parent.Triggered?
when it triggered the proximity prompt which is the parent of the script
okay just wanted to know that
i want to like make it change the objective again after the task.wait
what do you want to change?
yeah
i want it to change after task.wait
and im not a good scripter
so idk how do to the script
okay so just change the text after task.wait
yeah and how do i do it
oh, its a Server Script?
but you want to change the UI?
the text
so just make a RemoteEvent
of the textlabel
** You are now Level 5! **
how do i do remote events 😭
what should i call it
change the name to something like "SinkTextModule"
in your Server Script type:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Module = ReplicatedStorage:WaitForChild("Module")
[Change Module with the correct name]
and at the end of the 15 seconds do:
Module:FireClient(player)
yeah
in local Script do:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Module = ReplicatedStorage:WaitForChild("Module")
local player = game.Players.LocalPlayer
Module.OnClientEvent:Connect(function()
end)
and then you can write the Code inside the Module
what local script-
the TextLabel is inside the PlayerGui, correct?
my brain isn't braining
yeah
then just put the local Script inside the ScreenGui
then do that what i did, and add the Labels, etc. and Change the Text inside the Module.OnClientEvent
yeah
what should i type on it
try turning it off and back on again
lemme try
name it to that, what it does
gtg now buy some stuff
windows xp sound
alr, i refreshed my brain
what now
learn the basics
i already did
what is object hierarchy
fantastic, now put the basics into practice 
...
you said you learned the basic
how 😭
wat is object hierarchy
basics like building, printing, booleans and stuff
i js want my game finished to play it with my friends

thats the entire reason i joined this server
you mean the same entire reason a lot of other people join this server? free code, free games, make the next big thing since brookhaven and pay 0.0001% of revenue when it's popular?
the difference between those people and people who have games are the ones who have games put in the time, effort, and the hard work (or robux) to make it happen 👍
i wanna put hard work
scripting is very simple when you get the hang of the basics, most important skills you need is debugging and reading the documentation http://wiki.roblox.com
i don't care if it takes 3 months
i want to be a better scripter
and every script i type i also wanna understand
and perhaps an understanding that you aren't going to get your code perfect and flawless on your first try, you're going to run into problems you don't understand, there's where google comes in 
asking 'WhErE dO i PuT tHaT' is not even helpful to yourself, try not to get complacent in that behavior.
some people do and it's not pretty for them ;o
how can i become better
without having to watch blender gurus tutorial in roblox studio version
i've been telling you how. read the docs. practice. make simple things. watch tutorials for ideas and concepts, but do not copy, reproduce it in your own way
believe it or not but all games are just lots of small simple things all connected to each other
ik
i'm not sure where this problem has gotten to in the past 200+ messages but i aint reading allat. if you want a proximity prompt, you start with the proximityprompt.
if you want to make a gui, then you start with the gui.
if you want a proximityprompt that interacts with a gui, you need to have both of those things first.
and the thing about guis are, go figure, buttons don't do anything without a script connected to it.
healthbars dont move without a script connected to it.
you didn't finish the gui step.
i have a text
i have a script
the player interacts with the sinks to wash is hands
the tex changes from wash your hands to explore the house
the player walks around
after 15 seconds
the objective changes to "go outside"
what part of this exactly are you stuck on?
task.wait(15) then update the objective same way you did before.
task.wait does exactly what it says on the tin - it waits.
im stupid
i could've just read the script and paste the ones that change the objective 😭
@hardy nimbus
can you explain me this error?
what do you think it is trying to say?
why can't you understand it?
understanding errors is probably the most important part of coding
i can see that it mentions the script of the proximity prompt
yes, what else does it mention?
where do i learn to understand errors?
you could google the error
or you could read it
sometimes the error isn't clear, but this one is
"expected 'end' ( to close 'then at line 5)
don't fall into the newb trap of going oh red text, panic!
what's on line 5?
and what does the error say?
to close it with a (?
how do you normally write an if statement?
if ohio == script.parent then
print("idk")
at the top
local ohio = game.workspace.things.ohio
if "something happens" then
-- Make something else happen
end
i typed it right
OH
END
there it is 
but i already put and end ther
yet the error says you didn't
local wash = false
local Prompt = script.Parent
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()
end
task.wait(15)
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Go Outside"
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
so which do you think is more likely: you did put an end, or you did not?
maybe that end is for something else?
this is why indentation helps a lot
correct indentation, i should say.
count how many closures you have, and count the ends.
as i learned they said spaces dont matter
a closure is anything that needs an 'end' after it.
like an if statement, for statement, functions, etc.
is closure ")"?
there i added end
** You are now Level 6! **
i'm not exaggerating when i say count your closures
;compile lua ```lua
if a then
if b then
if c then
for a in {1,2} do
-- stuff
end
end
end
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:8: 'end' expected (to close 'if' at line 1) near <eof>
where is the missing end?
you can see there's 4 opening closures, and only 3 ends.
;compile lua ```lua
if a then
if b then
if c then
for a in {1,2} do
-- stuff
end
end
end
end
that was just a contrived example, and it is very obvious from the indentation
if i mess up the indentation like you do in your code, it is far less obvious
if a then
if b then
if c then
for a in {1,2} do
end
end
end
:compile lua
``alocal wash = false
local Prompt = script.Parent
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
end
``
yeah thats not going to work
;compile lua
``alocal wash = false
local Prompt = script.Parent
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
end
``
anyway, you have a missing end, go look for it.
go through your entire code line by line if you have to.
hm
do this this one time, and hopefully you'll learn how to deal with them easier in the future when you figure out what is stealing their end from the if statement the error mentions.
4 closures
i've already spotted it but it's up to you to fix your own code. you know what's wrong with it now, so go fix it 
so was i right with 4 closures?
4 closures and 4 ends
if a then -- +1
if b then -- +1
end -- -1
for x in {1,2} do -- +1
end -- -1```
if you have +1 or more at the end, you have a missing end. if you have -1 or less, you have too many ends.
pretty simple
anyway i gotta go do some stuff gl
@proud haven
ye?
can you send me your script?
k
local wash = false
local Prompt = script.Parent
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
end
end
end
for i,plr in pairs(game.Players:GetChildren()) do
if plr:IsA("Player") then
local plrgui = plr.PlayerGui
plrgui.Objective.TextUI.Text = "Objective: Go Outside"
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
there was also this error
Workspace.Things.Sink.SinkProximityPrompt.ProximityPrompt.Script:18: Expected ')' (to close '(' at line 4), got 'end'
so this isnt working?
local TextUI = game.Players.LocalPlayer.PlayerGui.Objective.TextUI
the one with the sink interaction works
but the thing with the 15 secs doesn't work
your script is so messy
** You are now Level 18! **
the one you send me is the one you use atm?
i use it in the proximity prompt
the same one that also runs the interaction of the sink
you should learn the basics...
i did
for loops, Proximity Prompt, playergui / Gui, Triggered Event
but i still dont figure out
learn that
can you teach me?
i want a script teacher
bc tutorials dont help
after
or when you take breaks
i do everything
and i will listen
pls
i can also test your game and tell bugs
i work on the game like 3-4 hours per day
when you finish one code
i can join you
and help you find bugs
but i can only add you to roblox studio with access to all the Codes, etc.
no
u can also add me to just playtest
or you can add me and give me permissions to play the gamre on roblox
not on Roblox Studio
alr whats ur user
i added you to Roblox Studio as playtester
theres not really that much in
cya
cya
its just like UI and Script
uh
i can't find the game to join
u mean in roblox studio?
or in roblox
roblox studio
whatss the game called
YouTube Infinity Simulator
where can i find the game?
nice
seems like im not finding it
hmm
lemme add you to my game to see if you can join it
kk
nope
my user is vinni_090509
i still dont see it
the objectives are bugged rn
it only shows in roblox studio
and i need help on the next objective
why can't you chat tho
i have to script my game now xD
they both activate chat
btw i animated the idle myself
wait
go to permissions and enable friends only
so i can test it out
permission in Roblox Studio or on the Roblox Website?
i can only choose between Public and Privat
i have it on private
