completely new to scripting so i’m still learning the basics. i’m working on a simple cooking feature that relies on transparency. however, the script fails when trying to make the tool transparent:
RamenPack is not a valid member of Tool “Workspace.oddmy.RamenPack”
i also want to exclude some parts/meshes within the tool and the tool’s handle when later running a 0 transparency loop. what should i use to achieve these things?
hopefully this strange script won’t come back to haunt me haha…
local cooking = script.Parent.Parent.RamenCook
script.Parent.Touched:Connect(function(Hit)
if Hit.Parent.Name == 'RamenPack' then
for i,v in pairs(cooking:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Transparency = 1
end
end
for i,v in pairs(Hit.Parent.RamenPack:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Transparency = 1
end
end
You could have a list of models that you want to blacklist when looking through
local Blacklist = {workspace.Duck,workspace.Car} -- Put your blacklisted models here
Then in your for loop…
for i,v in pairs(Hit.Parent:GetDescendants()) do
if v:IsA('Model') and not table.find(Blacklist,v) then
for i,v in pairs(v:GetDescendants()) do -- Since model does not have a transparency property, we need to loop through its parts
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Transparency = 1
end
end
end
end