I’m trying to figure out why my script won’t find a StringValue called CurrentServer even though it’s looking in the right place.
I have tried to use wait for child, and that didn’t seem to work.
local Cur = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("CurrentServer")
script.Parent.MouseButton1Click:Connect(function()
Cur.Value = "".. script.Parent.Parent.Parent.Server.Text ..""
script.Parent.Parent.Parent.Parent.Server.Bar.Server.Text = "".. Cur.Value ..""
game.ReplicatedStorage.RemoteEvents.AddPlayer:FireServer(Cur.Value, game.Players.LocalPlayer.Name)
end)
Workspace: https://gyazo.com/75304614f4e3476224d92d9387e58b7e
1 Like
XAXA
(XAXA)
#2
What is the error in the output window (if there is any?)
EDIT: It doesn’t even look like you’re indexing CurrentServer
…
Oof it didn’t copy paste sorry.
Edit: Fixed. Also, output is it saying it doesn’t exist in the Folder (PlayerGui) even though it should.
yelowfat
(yeIIow)
#4
formatting the string value like Cur.Value = ""..thing.Text..""
is unnecessary, just do Cur.Value = thing.Text
also your “Cur” variable is going through so many parents, seems easy to skip or mess up, and might be your problem.
for example, do
local Cur = game.ReplicatedStorage.RemoteEvents:WaitForChild("CurrentServer")
instead of
local Cur = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("CurrentServer")
the former is much simpler to index and organize.
Could we see your server code? perhaps the issue is there.