Hi! I am trying to make a RP Name UI, but I keep getting errors. It reads from a StringValue, but I can’t find out why the errors are coming. Any ideas?
settingframe.Confirm.MouseButton1Click:Connect(function()
plrData.RPName.Value = settingframe.Name.Text -- This is line 25
plrData.RPDesc.Value = settingframe.Description.Text
end)
Explorer:
Error 2
Error 2 code
Mouse.Button1Down:Connect(function()
if Mouse.Target.Parent:FindFirstChild("Humanoid") then
print(Mouse.Target.Parent.Name)
local plrFrame = game.Players.LocalPlayer.PlayerGui.PlayerInfo.plrFrame
local touchedplr = game.Players[Mouse.Target.Parent.Name]
local plrIDData = game:GetService("ReplicatedStorage").DataFolder[touchedplr.UserId].Data:WaitForChild("RPName").Value
plrFrame.Desc.Text = game:GetService("ReplicatedStorage").DataFolder[touchedplr.UserId].Data:WaitForChild("RPDesc").Value
plrFrame.Name.Text = "" .. plrIDData -- Line 15
plrFrame.Title.Text = "Area 14 | " .. game:GetService("ReplicatedStorage").DataFolder[touchedplr.UserId].Data:WaitForChild("RPName").Value
plrFrame.Visible = true
wait(5)
plrFrame.Visible = false
end
end)
The first error is saying that settingframe.Name.Text is nil. Make sure that you are referencing the frames correctly and that there is text in the Name button.
On another note, if you are insistent on using Name as the button’s name, you should use settingframe:FindFirstChild() since Name is also a property of settingframe. That could also be causing your first error.
The second error might be also caused by the error I stated directly above in regards to the Name property vs using :FindFirstChild().
Hope this helps, let me know if anything new pops up.
For error 2, I know this may not even be causing the error but just as a heads up, you do not have to concanate blank strings (i.e. text.Text = "" .. blah blah you can simply state text.Text = blah blah). Also, make sure the value is a string value. If the problem still persists, then try adding some :WaitForChild()s instead of directly using . to reference (to make sure that everything is loaded).
It’s getting the name (a property, which would be “settingFrame”) of the settingFrame, not the button named “Name.” Use FindFirstChild to avoid indexing properties by mistake, or rename your button. Basically, you’re trying to get ("settingFrame").Text, which isn’t a thing, so it gives you nil.