Help me solve my script

help me with hold the tweened

local uis=game:GetService("UserInputService")

uis.InputBegan:connect(function(input)
	if input.KeyCode==Enum.KeyCode.W then
		obj:TweenSizeAndPosition(
			UDim2.new(0, 200, 0, 200),
			UDim2.new(0.5, 0, 0.512, 0),
			3,
			"Out",
			"Linear",
			false,
			0
		)
		print("hi")
	end
end)

uis.InputEnded:connect(function(input)
	if input.KeyCode==Enum.KeyCode.W then
		obj:TweenSizeAndPosition(
			UDim2.new(0, 100, 0, 100),
			UDim2.new(0.5, 0, 0.5, 0),
			3,
			"Out",
			"Linear",
			false,
			0
		)
		print("bye")
	end
end)```

Located inside Screen gui then frame inside it local script
1 Like

What exactly is the issue with your script?

Idk its just dosnt work for me

Is that the full script / what is it supposed to do?

Yeah look at the location of the script

What errors come up in your output?

It’s about the function thing idk

Can you copy and paste it here for us to see? It’ll help us understand the problem better.

Look, if you want your script to be solved, you really need to help @tyrencia and me. Else we can’t really help you out with this issue.

is that a gui tween script or what?

1 Like

Yes it is a gui tween like I mentioned at the top of the topic

try this;

local uis=game:GetService("UserInputService")

uis.InputBegan:connect(function(input)
	if input.KeyCode==Enum.KeyCode.W then
		obj:TweenSizeAndPosition(
			UDim2.new(0, 200, 0, 200),
			UDim2.new(0.5, 0, 0.512, 0),
			"Out",
			"Linear",
			0
		)
		print("hi")
	end
end)

uis.InputEnded:connect(function(input)
	if input.KeyCode==Enum.KeyCode.W then
		obj:TweenSizeAndPosition(
			UDim2.new(0, 100, 0, 100),
			UDim2.new(0.5, 0, 0.5, 0),
			"Out",
			"Linear",
			0
		)
		print("bye")
	end
end)
1 Like

What’s the difference between the original and yours?

what was this exactly for? lol

image
btw, the script i edited above should work now

Umm thx for now but I will test it later

I’m pretty sure you are supposed to use Enum.EasingStyle.Linear, and Enum.EasingDirection.Out.

Really I’m not sure bc I’m not on my pc now

The final argument you entered is incorrect, you are supposed to enter a function to call there. Also, it is not required to enter that. Same goes for the third argument, that’s supposed to be a EasingDirection.

I’m pretty sure this would just instantly move the UI, since you are just entering 0 as the time.

uhm- can’t he just change it to 1? :roll_eyes: