I want this script, which works fine on one door (left one in vid), to work on all the others.
Ive looked around on other posts to see if they had a similar problem but i couldnt find one and i dont see a reason for the script to not work as the doors names are exactly the same along with the children.
local unlockableP = game.Workspace.UnlockableParts
local boltParts = unlockableP.BoltCutterParts
local plr= game.Players.LocalPlayer.PlayerGui:WaitForChild("LockedAreaNotif")
local backG = plr.MainBackground.Background
local message = plr.MainBackground.Background.Message
local soundNotif = game.SoundService.LockedNotif
local lockCut = game.SoundService.LockCut
local part = boltParts.Door
local prompt = part.ProximityPrompt
backG.Position = UDim2.new(1, 0,0.817, 0)
prompt.Triggered:Connect(function(player)
if player.Character:FindFirstChild("Bolt cutters") then
lockCut:Play()
part:Destroy()
else
soundNotif:Play()
backG.Visible = true
message.Text = part.Message.Value
backG:TweenPosition(UDim2.new(0.689, 0,0.817, 0))
task.wait(3)
backG:TweenPosition(UDim2.new(1, 0,0.817, 0))
task.wait(1)
backG.Visible = false
end
end)
Yea you’ll have to change that. You can do this to apply the script to every door (since every door has the same name):
local plr= game.Players.LocalPlayer.PlayerGui:WaitForChild("LockedAreaNotif")
local backG = plr.MainBackground.Background
local message = plr.MainBackground.Background.Message
local soundNotif = game.SoundService.LockedNotif
local lockCut = game.SoundService.LockCut
backG.Position = UDim2.new(1, 0,0.817, 0)
for i, part in pairs(boltParts:GetChildren() do -- get all boltPart's children
if part.Name ~= "Door" then continue end -- skip if not a door
local prompt = part.ProximityPrompt
prompt.Triggered:Connect(function(player)
if player.Character:FindFirstChild("Bolt cutters") then
lockCut:Play()
part:Destroy()
else
soundNotif:Play()
backG.Visible = true
message.Text = part.Message.Value
backG:TweenPosition(UDim2.new(0.689, 0,0.817, 0))
task.wait(3)
backG:TweenPosition(UDim2.new(1, 0,0.817, 0))
task.wait(1)
backG.Visible = false
end
end)
end
Hi thanks for the help but on ‘do’ it tells me to close a bracket at line 21 but i dont see any problems around that column, do you know the solution to this? I am fairly new and this is the first time ive seen this error