Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this "Incomplete Statement"?

Asked by 3 years ago

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

Log in to vote
0
Answered by
Roger111 347 Moderation Voter
3 years ago
Edited 3 years ago

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

Ad
Log in to vote
0
Answered by
FirezDevv 162
3 years ago

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)

Answer this question