I am trying to change the test of a surface ui according to a value. So basically, i have an object value, and i need the value written onto a surface ui. This is my coding and its not working:
ServerScript:
local obj = script.Parent.Obj
local label = script.Parent.Label.SurfaceGui.TextLabel.Text
game.Players.PlayerAdded:Connect(function()
if obj.Value ~= nil then
label = obj.Value
end
end)
No errors or anything, no spelling mistakes or wrong references. How could i make this work?
Edit: I have solved the problem in this script, but a new problem was created:
This is my script now:
local obj = script.Parent.Obj
local label = script.Parent.Label.SurfaceGui.TextLabel
game.Players.PlayerAdded:Connect(function()
if obj.Value ~= nil then
label.Text = obj.Value
end
end)
Now i have an error : invalid argument #3 (string expected, got Instance)

5 comments
Did you defined the ObjectValue value?
yes
What is the object value referencing to?
Its referencing the player's name
Try obj.Value.Name instead.