I am in need of assistance in order to figure out what is wrong with my drawer script.
1. The goal is so that the proximity prompt will show up the player will press E and the drawer should open. It does not use Tween service or anything like that instead it uses two drawers and by changing the properties of them when the player presses E to open the drawer it should make it seem like they opened it.
2. The issue however is that nothing happens. I do not get an error in the output window at all. But when I go over to open the drawer nothing happens.
3. I tried researching more on the matter myself but I still can’t seem to figure it out. Obviously I’m doing something wrong. Keep in mind I’m still new to scripting so.
Here is the script :
local proxprompt = game.Workspace.everything.Drawer["Drawer 1"].ProximityPrompt
local drawer = game.Workspace.everything.Drawer["Drawer 1"]
local opendrawer = game.Workspace.everything.Drawer["Drawer 2"]
proxprompt.Triggered:Connect(function()
drawer.Transparency = 1
drawer.cancollide = 0
opendrawer.Transparency = 0
opendrawer.cancollide = 1
print ("Drawer opened successfully!")
-- CoolDown
wait(3)
-- Revert back to normal
drawer.Transparency = 0
drawer.cancollide = 1
opendrawer.Transparency = 1
opendrawer.cancollide = 0
print("Drawer closed successfully")
end)
It would be very helpful if someone could help me.
(Also sorry if I posted in wrong topic i’m new)
The CanCollide property only accepts bools (true or false), so this would need to be changed from 0 and 1. Additionally, make sure you capitalize the property correctly so it doesn’t look for something called “cancollide” in the drawer.
No I’m using the proximity prompt “tool” (or whatever its called) that you can find in the workspace. I placed it inside the drawer. The premade one has a property that you should be able to change which automatically determines if the player is within range.
If the code is contained in a LocalScript, it has to be in one of the following locations in order to be activated:
A Player’s Backpack , such as a child of a Tool
A Player’s character model
A Player’s PlayerGui
A Player’s PlayerScripts .
The ReplicatedFirst service
Otherwise, the events of the ProximityPrompt can still be detected from a server script if you’d like the changes to the CanCollide & Transparency properties of those Instances in the Workspace to be replicated to other players.
A drawer is in pieces of furniture you pull it out and place items in it then place it back in i’m pretty sure you must have at least 1 in your home.
Wait no I meant why are you getting object reference like that. If you can tell me the path of the proximityprompt from workspace I could suggest another way to give reference to the proximityprompt. Like a screenshot of the explorer view so I can see the path to the proximity prompt.
Its workspace - Everything (model) -Drawer (model) and inside the Drawer model it has Drawer 1 and Drawer 2. Inside the drawer 1 model is where the proximity prompt is located.