I have been working on this piece of code, and I've come accross a bug, I believe. Here's the script.
local CompletedStage3 = false script.Parent.Text = " " Humanoid.WalkSpeed = 16 Humanoid.JumpPower = 50 workspace.Stage3KeycardPart.Success.Changed:Connect(function() if workspace.Stage3KeycardPart.Success.Value == true then CompletedStage3 = true for i = 1,#SuccessStage3 do script.Parent.Text = string.sub(SuccessStage3,1,i) workspace.Typing:Play() wait() end else CompletedStage3 = true for i = 1,#FailureStage3 do script.Parent.Text = string.sub(FailureStage3,1,i) workspace.Typing:Play() wait() end end end) if CompletedStage3 == true then print("completed") end
It is supposed to work, and it shows nothing in the output. No warnings, errors or prints. Any help please?
Oops! Sorry. Apparently the value of Success
actually affected the script. The value's default value was actually set to false
, so the script didn't find a change when the math.random
chose 1, or failure
. I fixed it using another value within the Stage3Keycardpart
called Failure
. This way, I can see if the player failed or not. Thank you for replying anyways!