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

tween script worked because but not getting error attempt to index number with 'TweenPosition'?

the script worked completely fine before but now Im getting this error. im lost, anyone have any idea why?

Error: attempt to index number with 'TweenPosition'

stat = script.Parent.Stat

remote.OnClientEvent:connect(function(player)
	

	stat:TweenPosition(
		UDim2.new(.3, 0, .6, 0),
		"Out",
		"Quad",
		.5,
		true
	)
	wait(3)
	stat:TweenPosition(
		UDim2.new(.3, 0, 1.1, 0),
		"Out",
		"Quad",
		1,
		true
	)

end)

3 comments

0

are you sure "stat" is a gui instance?

0

yes

0

stat is a member of a gui? (ex: frame/textlabel/textbutton) etc

1 answer

✓ Accepted answer

Short Awnser: You Forgot That You Need To Provide Enum Values

Long Awnser: You Need A Enum.EasingStyle And A Enum.EasingDirection

Awnser:

stat = script.Parent.Stat
remote.OnClientEvent:connect(function(player)
game:service("TweenService"):Create(stat,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Position = UDim2.new(.3,0,.6,0)}):Play()
wait(3)
game:service("TweenService"):Create(stat,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Position = UDim2.new(.3,0,1.1,0)}):Play()
end)

3 comments

0

Sorry If That's Confusing.

0

this isnt needed, the strings are the enum names, though it would be better practice to use enums

0

Yea I Know :)

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