Hello, I'm trying to change the transparency of an item by clicking it with a tool. Kind of new to FE coding and what not so, heres what I've gotten so far, but I keep getting the error mentioned above.
"BOBJECT" is the part im testing with. I was using print to see if it got that far, and it did. I've looked everywhere online to a solution, any help would appreciated.
local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local tar = mouse.Hit.p
local function Trans(partLookedAt)
tar.Transparency = tar.Transparency - 0.2
end
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
for i,tar in pairs(workspace:GetDescendants()) do
if tar.Name == "BOBJECT" then do
print(tar)
Trans()
end
end
end
end)
end)
mouse.Button1Down:Connect(Trans)

2 comments
To my understandings, mouse.hit.p is a Vector3 property. I think there is something wrong in your script. (i cant find a solution of this because my head hurts even looking at this (my scripts skills are not really advanced though))
i found a solution, only problem is its printing and it still wont change the transparency.