ClickDetector Issue

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.


It seems to be working completely fine for me when I click the mask.

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.

Video: https://streamable.com/i3tyuz

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

What do you want it to do? Just click the button? The code seems overcomplicated to me.

Thanks for fixing it, I’ll try it out later today!