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

So ? made a script for a button but ? have too much ends where to put them and how many ?

Asked by
gjlkv1 11
4 years ago

? wrote a code ( one of my firsts) to animate a button :

local FE = "e"
local object = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character
    while script.Parent.Parent.Parent.Visible == true   
do
    if game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode[FE] then
    object = guiObject:TweenSize(0, 85, 0, 85)
    end
end

as you can see theres 2 ends cause if ? put one it gives Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:10: Expected 'end' (to close 'function' at line 7), got <eof> if ? put 2 it gives Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:11: Expected ')' (to close '(' at line 7), got <eof> so having a little problem where to put them help please?

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Add an end) at the end of the script Here is a complete script

local FE = "e"
local object = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character
    while script.Parent.Parent.Parent.Visible == true   
do
    if  game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent) then -- why do you have if statement here if it is wrong then delete then and if, and delete end at the end
if inputObject.KeyCode == Enum.KeyCode[FE] then
    object = guiObject:TweenSize(0, 85, 0, 85)
    end
end)
0
Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:12: Expected 'then' when parsing if statement, got <eof> gjlkv1 11 — 4y
0
Add `then` at line 7 Nguyenlegiahung 1091 — 4y
0
Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:8: Expected identifier when parsing expression, got 'then' gjlkv1 11 — 4y
0
problem isnt with then etc etc its about puting ends gjlkv1 11 — 4y
View all comments (4 more)
0
Delete the then, why do you got a if at line 7 before function ? If that this correct then you are missing then (output error) or delete the if Nguyenlegiahung 1091 — 4y
0
have no idea ? was using the roblox devloper forum and it showd it like that gjlkv1 11 — 4y
0
but it doesnt fix my problem gjlkv1 11 — 4y
0
Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:10: Expected 'end' (to close 'function' at line 7), got <eof> gjlkv1 11 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Your script looks fine, except you should have three ends at the end of the code, not two. Just like this:

local FE = "e"
local object = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character

    while script.Parent.Parent.Parent.Visible == true do
        if game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent) then
        if inputObject.KeyCode == Enum.KeyCode[FE] then
                object = guiObject:TweenSize(0, 85, 0, 85)
            end
    end
end
0
Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:12: Expected ')' (to close '(' at line 7), got 'end' gjlkv1 11 — 4y
0
Add "then" on line 7. That should fix the problem. AntiWorldliness 868 — 4y
0
I edited the Script. That was my bad since I forgot to add the "then". AntiWorldliness 868 — 4y

Answer this question