KeyCard Door Not Working

So I have a keycard door, and when I put a tool that opens a door in StarterPack it works, but I have a tool giver and it is working, and when I get tool from toolgiver door does not want to open

Door script:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "Dollar" then
		script.Parent.CanCollide = false
		script.Parent.Transparency = 0.5
		wait(2)
		script.Parent.CanCollide = true
		script.Parent.Transparency = 0
	end
end)

Tool is in Lighting:

image

If someone know what is problem, I would appreciate their help! Thanks.

Make sure you’re giving the tool on the server (via a server script).

1 Like

Can you post the script that gives the tool?

If your door works when the tool is in StarterPack, then the door isn’t the problem.


I’m assuming that the tool giver script clones the tool from Lighting into the player’s backpack.

In which case, it may not have assigned a name to the clone, try something like this:

local _ = game:getService("Lighting"):FindFirstChild("Dollar"):Clone()
_.Name = "Dollar"
_.Parent = plyr.Backpack
1 Like

I will send you a tool giver script when I come from school.

Whenever you call Clone on an instance all of its properties are carried over except its ‘Parent’ property.

1 Like

Yep, unless OP is using a tool giver that changes the name.

Unlikely, but it seems like the issue is with the script that gives the player the tool, rather than the door script itself.

If it’s firing when the tool is placed in the StarterPack and the equality check pertains to the name, then my first question would be to check the name.