I need some help with this script

Im trying to get this script to work but it wont I need some help

local db = true

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
	script.Parent.Qusetion.Text = "ARE YOU SURE YOU WANT TO REBIRTH?"
	if not open then
		script.Parent.Visible = true
		open = true
	else
		script.Parent.Visible = false
		open = false
	end
end)


script.Parent.Yes.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.leaderstats.Strenght.Value < 5000 and db then
		db = false
		script.Parent.Question.Text = "YOU NEED ATLEAST 5,000 STRENGHT TO REBIRTH!"
		wait(3)
		script.Parent.Visible = false
		open = false
		db = true
	elseif db then
		game.ReplicatedStorage.Rebirth:FireServer()
		script.Parent.Visible = false
		open = false
	end
end)```

script.Parent.No.MouseButton1Click:Connect(function()
	if db then
		script.Parent.Visible = false
		open = false
	end
end)

game.ReplicatedStorage.Rebirth.OnClientEvent:Connect(function()
	script.Parent.Parent.Text:TweenPosition((UDim2.new(0.2, 0, 0.07, 0)), "Out", "Quad", 1)
	wait(3)
	script.Parent.Parent.Text:TweenPosition((UDim2.new(1.8, 0, 0.07, 0)), "Out", "Quad", 1)
	wait(1)
	script.Parent.Parent.Text.Position = UDim2.new(-0.6, 0, 0.07, 0)
end)

You misspelled question on line 5. You typed in “Qusetion”.

Also just a little bit of advice! When you’re asking questions on here please provide a few things such as. What is the error, if any? What do you expect the script to do, and what is it doing instead?

And try to keep good practice such as indenting your lines, and providing the code via the actual syntax which is the same as you would on discord with three of these: `

Here is your code with syntax, and indented correctly.

local open = false
local db = true

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
	script.Parent.Qusetion.Text = “ARE YOU SURE YOU WANT TO REBIRTH?”
	if not open then
		script.Parent.Visible = true
		open = true
	else
		script.Parent.Visible = false
		open = false
	end
end)

script.Parent.Yes.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.leaderstats.Strenght.Value < 5000 and db then
		db = false
		script.Parent.Question.Text = “YOU NEED ATLEAST 5,000 STRENGHT TO REBIRTH!”
		wait(3)
		script.Parent.Visible = false
		open = false
		db = true
	elseif db then
		game.ReplicatedStorage.Rebirth:FireServer()
		script.Parent.Visible = false
		open = false
	end
end)

script.Parent.No.MouseButton1Click:Connect(function()
	if db then
		script.Parent.Visible = false
		open = false
	end
end)

game.ReplicatedStorage.Rebirth.OnClientEvent:Connect(function()
	script.Parent.Parent.Text:TweenPosition((UDim2.new(0.2, 0, 0.07, 0)), “Out”, “Quad”, 1)
	wait(3)
	script.Parent.Parent.Text:TweenPosition((UDim2.new(1.8, 0, 0.07, 0)), “Out”, “Quad”, 1)
	wait(1)
	script.Parent.Parent.Text.Position = UDim2.new(-0.6, 0, 0.07, 0)
end)
1 Like

Okay thank you I will take ur advice.

In the future, please format your code with tick marks.

local var1=Instance.new("Part",workspace)
--you can format your code to support markup with tick marks

How it looks for me while I’m typing:
image

Okay Chip thanks for the advice.

I believe you could also have found this with the use of Script Analysis as it looks for inconsistencies like the code checking the value of a variable before it has been set which can be caused by a miss spelling.