I’m trying to change the transparency of a part after its clicked yet somehow the script is not managing to find it but when I make a print 1 line before the transparency changing it does find the part.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetTool = ReplicatedStorage["Yellow CD"]
local GetParent = script.Parent
GetParent.ClickDetector.MouseClick:Connect(function()
print(GetParent.CanPick.Value)
if GetParent.CanPick.Value == true then
print("passed condition")
print(GetParent.Parent.YellowCD)
GetParent.Parent.YellowCD = 1
print("changed transparency")
end
end)
Can you give us the directory of the script? You only gave us for the model, we need one for the script as well. I am confused as to why it works sometimes according to you.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetTool = ReplicatedStorage["Yellow CD"]
local GetParent = script.Parent
GetParent.ClickDetector.MouseClick:Connect(function()
if GetParent.CanPick.Value == true then
GetParent.Transparency = 1
end
end)
Perhaps it is the placement of your script, where is your script place, and what type of script is it? LocalScript or just Script (meaning serverScript). Reply to this so we can further discuss
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetTool = ReplicatedStorage["Yellow CD"]
local GetParent = script.Parent
GetParent.ClickDetector.MouseClick:Connect(function()
if GetParent.CanPick.Value == true then
GetParent.Transparency = 1
end
end)