I need help with my scripts

flashing black and white lights, and a sound playing

u can use bool Value

put a bool Value in each doll and when the player find the doll make the Value True and when all the Values are true in all the dolls Open the door

if boolValue1.Value == true and  boolValue2.Value == true  boolValue3.Value == true  boolValue4.Value == true then 
--Code

also maybe dont touch the

for i,v in pairs(workspace.dolls.doll1:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then	
			v.Transparency = 1
			if v.Transparency == 1 then
				doll:Destroy()
			end
			for i,v in pairs(workspace.dolls.CHAIR1doll:GetDescendants()) do
				if v:IsA("BasePart") or v:IsA("Decal") then
					v.Transparency = 0
					number.Transparency = 0
					

part because it works perfect

cool, how do you add a bool value to the scrips to make them work correctly

u don’t need to add them in the script add them in the doll Model (in each doll add one and Name it to Bool1,Bool2 etc…)

local doll1 = game.Workspace.dolls.CHAIR1doll
local doll2 = game.Workspace.dolls.CHAIR2doll
local doll3 = game.Workspace.dolls.CHAIR3doll
local doll4 = game.Workspace.dolls.CHAIR4doll
local click = script.Parent.ClickDetector
local open = script.Parent.Script
local locked = game.ServerStorage.locked
local boolValue1 = game.Workspace.dolls.doll1.Bool1
local boolValue2 = game.Workspace.dolls.doll2.Bool2
local boolValue3 = game.Workspace.dolls.doll3.Bool3
local boolValue4 = game.Workspace.dolls.doll4.Bool4

if boolValue1.Value == true and  boolValue2.Value == true and boolValue3.Value == true and boolValue4.Value == true then 
	
end

does this look correct?

also where should this script go? sorry

---Put this script into your GUI

local OrininalLighting = game.Lighting.Ambient

function OpenDoor ()
	--Door Opening script
end

function Jumpscare(doll)
	-- careful of epilepsy lol
	for i = 1,20 do -- Change 20 too how many flashes you want and change the wait(.2) to the time inbetween flashes
		game.Lighting.Ambient = Color3.fromRGB(255, 255, 255)
		wait(.2)
		game.Lighting.Ambient = Color3.fromRGB(255, 0, 0)
		wait(.2)
	end
	
	game.Lighting.Ambient = OrininalLighting -- Changes back to original lighting
	
	for i,v in pairs(doll:GetDescendants()) do -- no clue what your workspace looks like so ive just editted the code you had previously a bit
		if v:IsA("BasePart") or v:IsA("Decal") then	
			v.Transparency = 1
			if v.Transparency == 1 then
				doll:Destroy()
			end
		end
	end
	-- removed the Chairdoll cause idk what that is, let me know if that was important 
end
	


local DollsCollected = 0
local Dolls = game.Workspace.Dolls:GetChildren()

for i = 1,#Dolls do
	Dolls[i]:FindFirstChildWhichIsA("ClickDetector").MouseClick:Connect(function()
		if DollsCollected < #Dolls then
			DollsCollected +=1
			Jumpscare(Dolls[i])
			if DollsCollected == #Dolls then
				OpenDoor()
			end
		end
	end)
end

Put this into the player somewhere (Any gui/ starter player scripts) and if you have all the dolls in a folder called Dolls, and they all have click detectors as a Child then it should work

Youll need to disable the scripts you already have in the dolls, Dont delete them incase my script doesnt work. its not been tested

did you add the part where it makes the CHAIR1doll become visible?

What is Chair1, because I cant help you unless you give me all the information.

Did the Code I wrote work at all?

sorry for late reply, basically when you click the doll, it ā€œteleportsā€ somewhere else but in reality it just disappears and destroys and then another one in the other spot appears:

		if v:IsA("BasePart") or v:IsA("Decal") then	
			v.Transparency = 1
			if v.Transparency == 1 then
				doll:Destroy()
			end
			for i,v in pairs(workspace.dolls.CHAIR1doll:GetDescendants()) do
				if v:IsA("BasePart") or v:IsA("Decal") then
					v.Transparency = 0
					number.Transparency = 0
					end
				end
			end
		end
	end)

ive yet to test the script but i will now

just tested it, does not work. :frowning:

Any error messages?
and also did you put all the Dolls in a folder called ā€œDollsā€
and did u disable the previous scripts?

dolls are in folder, scripts are disabled, no errors. maybe we could work off of this script that another user gave me? this is all getting so confusing and ive been trying to figure this out for hours

local doll2 = game.Workspace.dolls.CHAIR2doll
local doll3 = game.Workspace.dolls.CHAIR3doll
local doll4 = game.Workspace.dolls.CHAIR4doll
local open = game.Workspace.teachDoor.Script
local click = open.Parent.handle1.ClickDetector
local locked = game.ServerStorage.locked
local boolValue1 = game.Workspace.dolls.doll1.Bool1
local boolValue2 = game.Workspace.dolls.doll2.Bool2
local boolValue3 = game.Workspace.dolls.doll3.Bool3
local boolValue4 = game.Workspace.dolls.doll4.Bool4

open.Disabled = true

click.MouseClick:Connect(function()
	locked.Enabled = true
	wait(2)
	locked.Enabled = false
end)





if boolValue1.Value == true and  boolValue2.Value == true and boolValue3.Value == true and boolValue4.Value == true then 
	
end

I dont know if i can help you anymore than this,

Because at this point i would need to literally go into the studio and do it which im not going to do

By the sounds of it your relying to much on people writing the code for you, so im assuming you may need to get a little bit more experienced with scripting in Lua. before a creating a game that requires a bit of coding

Best thing i can do is ask you to look at the code i wrote you and try to understand why its not working. as its either because an if statement isn’t activating or theres something wrong in your studio

thanks for nothing idk lol :////

I can try to help you more… Though I think you gotta try a bit yourself. Look save data and leaderstats up and teach yourself about that. I’ll alter my scripts to help you out and test it out.

no it’s fine this whole day has just been stressful. i tried for hours before i came to the devforum and nothing worked. i really do appreciate the help but with a bunch of people replying and me adding a bunch of scripts, everything got convoluted and i’m back at square one.

Dude. I was just like you with my save data script back when I was working on my simulator. Instead of an hours, I worked on that thing for days. Just the issue was I ddin’t know what it meant. And everytime I got different scripts and it was overwhelming. Its good practice for me to make this and ill try my best to explain the scripts. I really want to help you.