Hey, I am making pass code lock. Here is the script, but it doesn’t seem to be working or it just doesn’t want to print the thing I am clicking on.
local code = "123"
local input = ""
function red()
input = input..1
print(input)
end
script.Parent.Red.ClickDetector.MouseClick:Connect(red)
function green()
input = input..2
print(input)
end
script.Parent.Green.ClickDetector.MouseClick:Connect(green)
function blue()
input = input..3
print(input)
end
script.Parent.Blue.ClickDetector.MouseClick:Connect(blue)
Nope, still doesn’t work. I remade the script a bit and put it in StarterPlayerScripts.
local code = "123"
local input = ""
function red()
input = input..1
print(input)
end
game.Workspace.PassLock.Red.ClickDetector.MouseClick:Connect(red)
function green()
input = input..2
print(input)
end
game.Workspace.PassLock.Green.ClickDetector.MouseClick:Connect(green)
function blue()
input = input..3
print(input)
end
game.Workspace.PassLock.Blue.ClickDetector.MouseClick:Connect(blue)
local code = "123"
local input = ""
local ClickDetector1 = game.Workspace.PassLock.Red:WaitForChild("ClickDetector")
local ClickDetector2 = game.Workspace.PassLock.Green:WaitForChild("ClickDetector")
local ClickDetector3 = game.Workspace.PassLock.Blue:WaitForChild("ClickDetector")
function red()
input = input..1
print(input)
end
ClickDetector1.MouseClick:Connect(red)
function green()
input = input..2
print(input)
end
ClickDetector2.MouseClick:Connect(green)
function blue()
input = input..3
print(input)
end
ClickDetector3.MouseClick:Connect(blue)
It worked! But, what do you mean by “before the parts are replicated”?
Final Script:
local code = "123"
local input = ""
local Red = game.Workspace.PassLock:WaitForChild("Red")
local Green = game.Workspace.PassLock:WaitForChild("Green")
local Blue = game.Workspace.PassLock:WaitForChild("Blue")
local ClickDetector1 = Red:WaitForChild("ClickDetector")
local ClickDetector2 = Green:WaitForChild("ClickDetector")
local ClickDetector3 = Blue:WaitForChild("ClickDetector")
function red()
input = input..1
print(input)
end
ClickDetector1.MouseClick:Connect(red)
function green()
input = input..2
print(input)
end
ClickDetector2.MouseClick:Connect(green)
function blue()
input = input..3
print(input)
end
ClickDetector3.MouseClick:Connect(blue)
Instances have to replicate and load into the client from the server, the code is running before this happened - meaning it can not find them as they do not exist at that given time
Is there an order that container services are loaded in? For example: first one to load is ReplicatedFirst, then ServerScriptService, then workspace and so on…