So I was trying to create a script that checks the classname of the instance in an array and then prints it out. It does not work. I tried searching about this online with people who have had the same problem but all there scripts there where to complex. Can you please tell me am I doing wrong?
Error:
ServerScriptService.Script:6: attempt to concatenate string with Instance
Script:
local Food = game.Workspace.Food
local array = {Food, 5.4352, game.Workspace.ColorLooping.Parent}
local Value = array[1]
if Value.ClassName == "Part" then
print("Value's Classname is "Part"")
end
local Food = game.Workspace.Food
local array = {Food, 5.4352, game.Workspace.ColorLooping.Parent}
local Value = array[1]
if Value.Name == "Part" then
print("Value's Classname is " .. Value)
end
local Food = game.Workspace.Food
local array = {Food, 5.4352, game.Workspace.ColorLooping.Parent}
local Value = array[1]
if Value.ClassName == "Part" then
print("Value's Classname is " .. Value.Name)
end
I made so adjustments and how can I print the Value.Name in quotations?
local Food = game.Workspace.Food
local array = {Food, 5.4352, game.Workspace.ColorLooping.Parent}
local Value = array[1]
if Value.ClassName == "Part" then
print("Value's " .. Value.Name .. " Classname is " .. "Part")
end
MrFlawless
VakarisLDoE
Programmer
Tyler
1m
I made so adjustments and how can I print the Value.Name in quotations?
local Food = game.Workspace.Food
local array = {Food, 5.4352, game.Workspace.ColorLooping.Parent}
local Value = array[1]
if Value.ClassName == "Part" then
print("Value's '" .. Value.Name .. "' Classname is " .. "Part")
end