So I have recently been trying to make a little script that I can simply click on a part and the UI displays the properties of that part. Now for some reason, the UI text label is not changing, and I am running into no errors in the output log. So if someone is able to catch my problem that would be awesome!
local part = game.Workspace.Checking
local brickcolor = script.Parent.Color1.Text.Text
local clickDetector = game.Workspace.Checking.ClickDetector
function onMouseClick()
local testArray = {part.BrickColor, part.Size, part.Transparency,part.Position}
brickcolor = testArray[1]
end
clickDetector.MouseClick:connect(onMouseClick)
You only set it for 1 ui text. Try doing it for all of them like
location.Text = ... -- color (or) testArray[1]
location.Text = ... --Size testArray[2]
location.Text = ... -- Position testArray[3]
If this doesn’t work try using for i,v in pairs it may solve the problem.
EG:
for i,v in pairs(part:GetChildren()) do – GetChildren means everything in that location
v.ClickDetector.MouseClick:Connect(function()
location.Text = … – v. (something to do with color3) look here
location.Text = … --Size v. (look for size infomation here) ignore the “How to” Just look for how to locate the size.
location.Text = … – Position (look for position here) ignore the “How to” Just look for how to locate the position.
end)
end