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

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

? 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 if ? put 2 it gives Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:11: Expected ')' (to close '(' at line 7), got so having a little problem where to put them help please?

2 answers

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)

8 comments

0

Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:12: Expected 'then' when parsing if statement, got

0

Add then at line 7

0

Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:8: Expected identifier when parsing expression, got 'then'

0

problem isnt with then etc etc its about puting ends

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

0

have no idea ? was using the roblox devloper forum and it showd it like that

0

but it doesnt fix my problem

0

Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:10: Expected 'end' (to close 'function' at line 7), got

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

3 comments

0

Players.gjlkv1.PlayerGui.ScreenGui.ImageLabel.Frame.ImageButton.ImageButton.Loc:12: Expected ')' (to close '(' at line 7), got 'end'

0

Add "then" on line 7. That should fix the problem.

0

I edited the Script. That was my bad since I forgot to add the "then".

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