A door opens after interacting more than one times with a proximity prompt

Hello! I tried to do something and it is that when interacting more than once with a proximity prompt it opens. But it doesn’t seem to work, but for what I have made mistakes but I don’t know how to fix them :frowning: help please.


Oh and here is the script i use:

local interactionCount = 5

script.Parent.Touched:Connect(function(otherPart)
interactionCount = interactionCount + 1
end)
script.Parent.ChildAdded:Connect(function(child)
if child.Name == “ProximityPrompt” and child.InteractionCount.Value == 5 then
script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Position + Vector3.new(0, 5, 0)))
end
end)

Hey, can you show me the explorer?

Did you put the script into the proximity prompt? That’s not how they work, you need to use a script to detect using the proximity prompt service, which you can research on