Just to confirm, the clicking distance is high and you are clicking the part?
Yes, I click the part and it doesn’t detect me clicking.
Can you send me a repro file if possible?
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
I do not think you can just [quote=“Giggio450BR, post:1, topic:797374”]
Object.ClickDetector.MouseClick:Connect(function(Player)
[/quote]
I had another script but it does not have player as a function
So I think you can try my above to get the player…
Edit: Just ignore the debounce parts.
I tried it and it still doesn’t work unfortunately.
It’s probably an issue in my end then.
You’re probably doing something wrong in the script itself so it isn’t running but it should work, as mentioned by @EdibIeGames.
@Giggio450BR
How are you commencing your tests? I’m just clicking Play button in Studio.
Just tested it on the uncopylocked place I provided you and for some reason it’s working there but it’s not working in my main place even though they are literally the same script.
Are there any errors or warning in console? Or is the clickdetector possibly being deleted at some point by another script in your game? Check for any scripts that also could be messing with the mask.
No errors and the click detector isn’t being deleted.
I’m going to record it and send here.
I think the only way I can get this issue solved is by placing a script for every object instead of using one script and a for loop.
Add my Tag Jamie#8195
hitting the limit
Just sent you a request, daZau_nis#9283
I’ve fixed the problem, it was with the module returning a function which basically stopped the code. Also your module was useless since you never used it properly.
Call the module:
--[[Scripted by daZau_nis#9283]]--
local module require(script.GameInit)
module.loopObject()
Module:
local module = {}
function module.loopObject()
for _, object in next, workspace.Givers.ClickDetector:GetChildren() do
if object.Name == "MonkeyMask" then
object.ClickDetector.MouseClick:Connect(function(Player)
local character = Player.Character
if not character:FindFirstChild("MonkeyMask") then
local newMask = object:Clone()
local weld = Instance.new("WeldConstraint")
newMask.Parent = character
newMask.CFrame = character.Head.CFrame
weld.Part0 = character.Head
weld.Part1 = newMask
weld.Parent = newMask
end
end)
end
end
end
return module