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

Why can't Enum be modified?

Why can't Enum be modified? i was scripting something for a gui and doesen't let me "modify" Enum with scripting

local Changelog = script.Parent.Parent.Changelog

script.Parent.MouseButton1Click:connect(function()
	Changelog:TweenPosition(UDim2.new(0, 0,0.223, 0)) Enum.EasingStyle.Quart = Enum.EasingDirection.Out
	wait(1)
	script.Parent:TweenPosition(UDim.new(-0.15, 0,0, 228)) Enum.EasingStyle.Quart = Enum.EasingDirection.Out
end)

-- {0, 0},{0, 228}
--{0, -210},{0.223, 0}
-- Those are for helping me ;v

7 comments

0

Why would you want to modify Enum

0

To do TweenPosition in a GUI

0

It is not done like that, it should be TweenPosition(position, Enum.EasingDirection.Out, Enum.EasingStyle.Quart)

0

Now i get Unable to cast UDim to UDim2

0

Line 6. You used UDim.new() instead of UDim2.new().

0

now i get 19:22:24.763 - Players.TheEdyGamerTroll23.PlayerGui.ScreenGui.TextButton.ok:4: attempt to call field 'Quart' (a userdata value)

0

Youre assign a enum to other then !!

2 answers

✓ Accepted answer

You're attempting to assign an enumeration to another enumeration - you can't do that and you're also using TweenPosition the wrong way.

Changelog:TweenPosition(UDim2.new(0, 0, 0.223, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad)

wait(1)

script.Parent:TweenPosition(UDim2.new(-0.15, 0, 0, 228), Enum.EasingDirection.Out, Enum.EasingStyle.Quart)

Also, why the Unable to cast UDim to UDim2 error happens because you're using a UDim, when the expected date type is supposed to be UDim2.

Here's a tip for you: A function's parameters that's expected to be enums can have their arguments passed as the enum's name.

Here's what I mean:

Changelog:TweenPosition(UDim2.new(0, 0, 0.223, 0), 'Out', 'Quart')

With that, you can just type in 'Out' instead of Enum.EasingDirection.Out

2 comments

0

Thanks!, it worked perfectly!

0

But Enums would be faster than strings, because Enums are direct references to the arguments whilst strings would have to do a little more searching.

Not sure if this will help but I never use Enum to change the Easing style of a Tween I just use this

local frame = script.Parent
frame:TweenPosition(UDim2.new(0,0,0,0), 'Out', 'Elastic', 2)

2 comments

0

ty dude!

0

It is technically correct to use Enum. as the string names could be changed at any time by Roblox.

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