Im trying to do a script that once the player clicked a part 3 times it print Secret Unlocked but its not working
Full script
local script : ( working all good )
Workspace :
the detect script :
Im trying to do a script that once the player clicked a part 3 times it print Secret Unlocked but its not working
Full script
local script : ( working all good )
Workspace :
the detect script :
this is a serverscript inside a clickdetector right
Please provide me all of the code so i can help.
Did you add a something related to clicking? Such as:
script.Parent.ClickDetector.MouseClick:Connect (function()
Your question is confusing and does not really make much sense. Could you be more specific?
You should post the whole script and have it show the activated by a MouseClick event/function, or at least explain the context this is under.
I just edited the post i tried my best to be specific
Are there any errors in the output?
No there is no error in the output
You could try:
function onClicked()
workspace.Room.Handle1.CFrame = workspace.Room.Handle1.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 1)
workspace.Secret.Cogs.Value += 1
if workspace.Secret.Cogs.Value == 3 then --checks it each time a player clicks
print("Secret Unlocked")
end
end
workspace.Part1.ClickDetector.MouseClick:Connect(onClicked)
Use this all in one server script. Also, please use :Connect
instead of :connect
because it is deprecated, and doing something.Value = something.Value + 1
is the same thing as something.Value += 1
.
This only runs once when the game starts. Instead, do:
script.Parent.Changed:Connect(function(Value)
if Value == 3 then
print("Secret unlocked")
end
end)
Thank you it worked!!!
It also worked but i cant mark 2 post as solution ty!