Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Someone Can help me with my for Open Door with ProximityPrompt ?

Asked by 2 years ago

I try to make a system for Open a door with tool with ProximityPrompt , but the script not working, i try to fix him but i found no solution to fix him.

local Door = script.Parent.Parent.Parent.Parent.Parent.Door.Door
local player = game.Players.LocalPlayer
local tool = player.Backpack:FindFirstChild("KeyPadCracker")
local Prompt = script.Parent
local DrillingSound = script.Parent.Parent.Parent.DrillSound



if tool then
    script.Parent.Triggered:Connect(function()
        Door.Transparency = 1
        Door.CanCollide = false
    end)
end

1 answer

Log in to vote
0
Answered by 2 years ago

if your using a normal script localplayer wont work so what you should do is remove the player and tool variable

also remove the if statement. then for the prompt part it should look like this instead

--because the paramaters for the proximityprompt is the player who activated it
Prompt.Triggered:Connect(function(player) 

    --it waits for the keypadcracker in the players backpack so it has to be unequipped to use it
    --if its there then the door transparency and cancollide properties will change
    if player.Backpack:WaitForChild("KeyPadCracker") then
        Door.Transparency = 1
        Door.Cancollide = false
    end
end)

So i hope this helped you but make sure you keep the other variables

Ad

Answer this question