Hey, I’m working on a game, and I’m struggling with a nuke that I’m making. I’ve been scripting for a while, but I just cant get the hang of it. There’s this bug that I can’t figure out that after you say “No”, if you say “Yes” it will continue to ignore all of the false variables I put in to stop that. Can somebody help me? Here’s my code:
Evanthegr8t1:
local CardScanner = game.Workspace.CardScanner
local OpenPart1 = game.Workspace.OpenParts.OpenPart1
local OpenPart2 = game.Workspace.OpenParts.OpenPart2
local Nuke = game.Workspace.OpenParts.Nuke
local Explosion = game.ReplicatedStorage.Explosion
local NukeScreen = game.Workspace.Screen.SurfaceGui.TextLabel
local Platform = game.Workspace.OpenParts.Nuke.Part
local Players = game:GetService(“Players”)
local Camera = game.Workspace.Camera
local MessageLock = true
Enabled = false
local TweenService = game:GetService(“TweenService”)
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local OpenPart1Open = {CFrame = OpenPart1.CFrame + OpenPart1.CFrame.LookVector *10}
local OpenPart1Close = {CFrame = OpenPart1.CFrame}
local OpenPart2Open = {CFrame = OpenPart2.CFrame + OpenPart2.CFrame.LookVector *10}
local OpenPart2Close = {CFrame = OpenPart2.CFrame}
local NukeRise = {CFrame = Nuke.CFrame + Nuke.CFrame.LookVector *40}
local NukeLaunch = {CFrame = Nuke.CFrame + Nuke.CFrame.LookVector *800}
local NukeDrop = {CFrame = Nuke.CFrame - Nuke.CFrame.LookVector *500}
local Open1 = TweenService:Create(OpenPart1, tweenInfo, OpenPart1Open)
local Close1 = TweenService:Create(OpenPart1, tweenInfo, OpenPart1Close)
local Open2 = TweenService:Create(OpenPart2, tweenInfo, OpenPart2Open)
local Close2 = TweenService:Create(OpenPart2, tweenInfo, OpenPart2Close)
local Rise = TweenService:Create(Nuke,tweenInfo, NukeRise)
local Launch = TweenService:Create(Nuke, tweenInfo, NukeLaunch)
local Drop = TweenService:Create(Nuke, tweenInfo, NukeDrop)
CardScanner.Touched:Connect(function(PartThatTouched)
local Keycard = PartThatTouched.Parent
if Keycard.Name == "Warhead Keycard" then
local Player = Players:GetPlayerFromCharacter(Keycard.Parent)
if Enabled == false then
Enabled = true
if Player.Name == " " then
NukeScreen.Text = "Go away nobody cares about you here"
wait(3)
Enabled = false
NukeScreen.Text = "Insert Nuclear Clearance Card."
else
wait(.1)
NukeScreen.Text = "Scanning..."
wait(3)
NukeScreen.Text = "You have been identified as: " .. Player.Name
local rank = Player:GetRoleInGroup(2949468)
wait(5)
local PlayerGui = Player:WaitForChild("PlayerGui")
local Enter = PlayerGui.PasswordGui.Frame.Enter
local Password = PlayerGui.PasswordGui.Frame.Password
local SurfaceGui = Enter.Parent.Parent.Parent.PasswordGui
NukeScreen.Text = "Enter Password to Continue."
SurfaceGui.Enabled = true
game.ReplicatedStorage.PasswordCloseEvent.OnServerEvent:Connect(function()
wait(5)
SurfaceGui.Enabled = false
Enabled = false
NukeScreen.Text = "Insert Nuclear Clearance Card."
end)
game.ReplicatedStorage.PasswordEvent.OnServerEvent:Connect(function()
Password.Text = ""
SurfaceGui.Enabled = false
NukeScreen.Text = "Authorized. Would you like to activate the nuclear dettonation procedure? Say: Yes or No to choose."
Player.Chatted:Connect(function(Message)
MessageLock = false
if Message == "Yes" then
if MessageLock == false then
MessageLock = true
wait(1)
NukeScreen.Text = " Nuclear Detonation Procedure Commencing..."
wait(5)
Open1:Play()
Open2:Play()
wait(3)
Rise:Play()
wait(5)
wait(3)
Platform.Anchored = true
Platform.WeldConstraint:Destroy()
NukeScreen.Text = "10"
wait(1)
NukeScreen.Text = "9"
wait(1)
NukeScreen.Text = "8"
wait(1)
NukeScreen.Text = "7"
wait(1)
NukeScreen.Text = "6"
wait(1)
NukeScreen.Text = "5"
wait(1)
NukeScreen.Text = "4"
game.ReplicatedStorage.Particles.Parent = Nuke
wait(1)
NukeScreen.Text = "3"
wait(1)
NukeScreen.Text = "2"
wait(1)
NukeScreen.Text = "1"
wait(1)
NukeScreen.Text = "0"
wait(1)
NukeScreen.Text = ""
Launch:Play()
game.ReplicatedStorage.Warning:FireAllClients()
wait(3)
Nuke.Orientation = Vector3.new(-90, 0, 0)
wait(3)
Close1:Play()
Close2:Play()
wait(1)
Drop:Play()
game.Workspace.OpenParts.Nuke.Particles.Parent = game.ReplicatedStorage
wait(0.5)
Nuke:Destroy()
wait()
Explosion.Parent = game.Workspace
for count = 1, 100 do
wait(0.1)
Explosion.Size = Explosion.Size + Vector3.new(20)
for i, touched in pairs(Explosion:GetTouchingParts()) do
touched.Material = Enum.Material.CorrodedMetal
end
end
else
return
end
game.ReplicatedStorage.Sky.Parent = game.Lighting
Explosion.Size = Vector3.new(1)
Explosion.Parent = game.ReplicatedStorage
wait(7)
NukeScreen.Text = "Nuclear Dettonation Complete, Remaining Shells: 0/1."
elseif Message == "No" then
if MessageLock == false then
MessageLock = true
wait(1)
Enabled = false
NukeScreen.Text = "Insert Nuclear Clearance Card."
else
return end
end
end)
end)
end
end
end
end)
can you reply to this post quoting the part of the script that you are talking about, i cant seem to find it.
NukeScreen.Text = "Authorized. Would you like to activate the nuclear dettonation procedure? Say: Yes or No to choose."
Player.Chatted:Connect(function(Message)
MessageLock = false
if Message == "Yes" then
if MessageLock == false then
MessageLock = true
wait(1)
NukeScreen.Text = " Nuclear Detonation Procedure Commencing..."
wait(5)
Open1:Play()
Open2:Play()
wait(3)
Rise:Play()
wait(5)
wait(3)
Platform.Anchored = true
Platform.WeldConstraint:Destroy()
NukeScreen.Text = "10"
wait(1)
NukeScreen.Text = "9"
wait(1)
NukeScreen.Text = "8"
wait(1)
NukeScreen.Text = "7"
wait(1)
NukeScreen.Text = "6"
wait(1)
NukeScreen.Text = "5"
wait(1)
NukeScreen.Text = "4"
game.ReplicatedStorage.Particles.Parent = Nuke
wait(1)
NukeScreen.Text = "3"
wait(1)
NukeScreen.Text = "2"
wait(1)
NukeScreen.Text = "1"
wait(1)
NukeScreen.Text = "0"
wait(1)
NukeScreen.Text = ""
Launch:Play()
game.ReplicatedStorage.Warning:FireAllClients()
wait(3)
Nuke.Orientation = Vector3.new(-90, 0, 0)
wait(3)
Close1:Play()
Close2:Play()
wait(1)
Drop:Play()
game.Workspace.OpenParts.Nuke.Particles.Parent = game.ReplicatedStorage
wait(0.5)
Nuke:Destroy()
wait()
Explosion.Parent = game.Workspace
for count = 1, 100 do
wait(0.1)
Explosion.Size = Explosion.Size + Vector3.new(20)
for i, touched in pairs(Explosion:GetTouchingParts()) do
touched.Material = Enum.Material.CorrodedMetal
end
end
else
return
end
game.ReplicatedStorage.Sky.Parent = game.Lighting
Explosion.Size = Vector3.new(1)
Explosion.Parent = game.ReplicatedStorage
wait(7)
NukeScreen.Text = "Nuclear Dettonation Complete, Remaining Shells: 0/1."
elseif Message == "No" then
if MessageLock == false then
MessageLock = true
wait(1)
Enabled = false
NukeScreen.Text = "Insert Nuclear Clearance Card."
else
return end
end
end)
end)
end
end
end
end)
So after the player clicks the “no” button, the “yes” button no longer works?
No, the player SAYS no. or Yes. It happens vice versa. That’s why i sent the code, idk what i did wrong.
Also, its the complete opposite, if i say no, then yes, the meaning of “No” was to stop it from working and to reset it. However, if you say “Yes” after it, it still goes through with it. That’s the problem
Then the problem must be that you didn’t reset everything to the way it was before you pressed the button.
What is MessageLock btw?
its used to stop it from happening but it doesnt work, heres a video, itll help you understand
robloxapp-20220717-1022043.wmv (2.6 MB)
how do you do that though lmfao
Qinrir
(Quin)
July 17, 2022, 2:30pm
#12
First and foremost. Your using CFrame wrong.
local NukeRise = {CFrame = Nuke.CFrame * CFrame.new(0,0,40)}
local NukeLaunch = {CFrame = Nuke.CFrame * CFrame.new(0,0,800)}
local NukeDrop = {CFrame = Nuke.CFrame * CFrame.new(0,0,-840)}
that. is. not. the. problem. ok?
Qinrir
(Quin)
July 17, 2022, 2:32pm
#14
oh. ok. thought. it. was. the. problem. cuz. the. post. gave. me. a. stroke. cuz. how. compact. it. was.
ok so
ඞ
look at the video i sent a couple posts above, it will show you what the problem is
Qinrir
(Quin)
July 17, 2022, 2:40pm
#16
Ok amogus person the problem is that when you say No the script does NOT stop. Which u know now what you can do. Is make a variable thats called doNuke
If its true than “Yes” would work. And when you insert ur keycard its set to true and yea if u say “No” its set to false. Get it? I am not gonna do it cuz how messy that script is.