Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix this "Incomplete Statement"?

So, I ran into a bit of an issue. I am extremely new to coding in lua. And I am trying to make a fade-out when you click on the "start!" or "play." button.

-- Variables --
MainMenu = game.Workspace.StarterGui.MainMenu
Transparency = MainMenu.cfg.Transparency
Play = MainMenu.d3.gui.Background.TextButton
Title = Play.parent.Title
BG = Title.parent
Blank = MainMenu.parent.Blank.frame
Clicked = false

-- Script --
if Play.Mouse1Click then
	Clicked = true
end

if Clicked == true then
	Play.BackgroundTransparency = Transparency.Value
	Title.TextTransparency = Transparency.Value
	BG.TextTransparency = Transparency.Value
	if Transparency.Value ~= 1 then
		Transparency.Value + 0.1 -- Error Right Here!
		wait(0.1)
	end
end

2 answers

ANSWER: You just have the wrong syntax for Lua

CODE FIX:

Transparency.Value = Transparency.Value + 0.1

Note: You can also use Transparency.Value += 0.1 in the new Luau

The problem I see is at line 11 you can use Mouse1Click since it isn't a function and you can if it you can only do Play.MouseButton1Click:Connect(function() --info end)

This discussion is preserved as it was. New answers, comments, and votes are closed.