I’ve just coded this and can’t figure out what the issue is. It prints “a” and “b”, nothing more.
Script:
for _, Object in next, Workspace.Givers.ClickDetector:GetChildren() do
print("a")
if Object.Name == "MonkeyMask" then
print("b")
Object.ClickDetector.MouseClick:Connect(function(Player)
print(1)
local Character = Player.Character
if Character then
print(2)
if not Character:FindFirstChild("MonkeyMask") then
print(3)
local NewMask = Object:Clone()
NewMask.Parent = Character
NewMask.CFrame = Character.Head.CFrame
print(4)
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Character.Head
Weld.Part1 = NewMask
Weld.Parent = NewMask
print(5)
end
end
end)
end
end
Maybe something like that? I’ve recoded some aspects to make it easier and actually find its ClickDetector, seeing everything that has been discussed here.
for _, object in pairs(Workspace.Givers.ClickDetector:GetChildren()) do -- Changed it to pairs instead of next statements
print("a")
if object.Name == "MonkeyMask" then
print("b")
object.ClickDetector.MouseClick:Connect(function(Player)
print("c")
local Character = Player.Character
if Character ~= nil then
print("d")
if Character:FindFirstChild("MonkeyMask") == nil then -- Checks if they already have it
print("e")
local NewMask = object:Clone()
NewMask.Parent = Character
NewMask.CFrame = Character.Head.CFrame
print("f")
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Character.Head
Weld.Part1 = NewMask
Weld.Parent = NewMask
print("g")
end
end
end)
end
end