Tweenservice not working!

so i made a local script in screen gui and there is also a erorr!
script:


local Blur = Instance.new("BlurEffect", game.Lighting)
wait(0.1)
local ts = game:GetService("TweenService")

local playbutton = script.Parent.playbutton
local creditsbutton = script.Parent.CREDITS

playbutton.MouseButton1Click:Connect(function()
	local tweeninfo = TweenInfo.new(
		2,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		1
	)
	local goal = {
		UDim2.new(-0.162, 0,0.248, 0);
	}
	
	
	local a= ts:Create(playbutton, tweeninfo, goal)
	local t= ts:Create(creditsbutton, tweeninfo, goal)
	
	t:Play()
	a:Play()
	
	
	
end)


and the erorr is this:

Unable to cast to Dictionary 

any feedbacks ty!

This is probably because you didn’t put the name of the property you want to tween here. This part should be like the one below (replace PROPERTY_NAME with desired property)

local goal = {
	PROPERTY_NAME = UDim2.new(-0.162, 0,0.248, 0);
	}

but it worked, like it works without the property part name…
ima try it ty for ur feedback!

1 Like

yes you’ll need to add a dictionary for the udim2.new as it can be used for size and position

1 Like

but i done it once before and i dint needed the proberty name. uh is it changed now ?

not sure but make sure to use it

sorry but i tryed this script i figured out a erorr! but it still has a erorr
script:


local Blur = Instance.new("BlurEffect", game.Lighting)
wait(0.1)
local ts = game:GetService("TweenService")

local playbutton = script.Parent.playbutton
local creditsbutton = script.Parent.CREDITS

playbutton.MouseButton1Click:Connect(function()
	local tweeninfo = TweenInfo.new(
		2,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		1
	)
	local goal  = {
		playbutton = UDim2.new(-0.162, 0,0.248, 0)
		

	}

	
	local a= ts:Create(playbutton, tweeninfo, goal)
	
	

	a:Play()
	
	
	
end)


erorr:

TweenService:Create no property named 'playbutton' for object 'playbutton'

thats a instance not a property, what are you using the tween on?

well, its a local script inside the screen gui, and i am using it for like textbutton or for the frame yea!

are you using to increase the size or position?

i am trying to increase the position!

then do "Position = UDim2.new(-0.162, 0, 0.248, 0)

i am dumb. bro i just took it from the size not position…

ah so replace position with size and it should work.

1 Like

omg it works, ty i will mark u as a solution tysm!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.