Ok, lets try it
I already saw a lot of people missing the "equipped" function of the tools. So lets apply it here so you can know how to fix this problem again in the future!
First Step : We need to know how and where we can use the equipped() function. So lets take an expample I made.
03 | local tool = game:GetService( "ReplicatedStorage" ).Tool |
04 | local messageP = "We are fine!" |
08 | local function equipped() |
12 | script.Parent.Equipped:Connect(equipped) |
And that's how we get the "Equipped" function. We can get even a character or a Humanoid. But now we will use this even to make it like you want
Second Step : Enjoy coding! You always have to enjoy what are you doing! Play some music while you script or even play something before to be relaxed!
Lets get into the code!
03 | local function equipped() |
04 | if script.Parent.Equipped then |
05 | workspace:FindFirstChild( "Door" ).CanCollide = false |
11 | local function equippedFinished() |
12 | if not script.Parent.Equipped then |
13 | game:GetService( "ReplicatedStorage" ).Status.Value = "Its to dark here! You need a lintern! Or maybe a flashlight" |
15 | game:GetService( "ReplicatedStorage" ).Status.Value = "" |
21 | script.Parent.Equipped:Connect(equipped) |
23 | script.Parent.Unequipped:Connect(equippedFinished) |
27 | local warnMessage = "The script is incorrect!" |
And that's all! Now you can enjoy your pieces of code! If this helps you let me know.
I hope my answer already solve your question. If is that the case, please accept my answer. That will help me a lot!
Keep scripting!