Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can't Enum be modified?

Asked by 5 years ago
Edited 5 years ago

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
0
Why would you want to modify Enum User#19524 175 — 5y
0
To do TweenPosition in a GUI TheEdyGamerTroll23 15 — 5y
0
It is not done like that, it should be TweenPosition(position, Enum.EasingDirection.Out, Enum.EasingStyle.Quart) User#19524 175 — 5y
0
Now i get Unable to cast UDim to UDim2 TheEdyGamerTroll23 15 — 5y
View all comments (3 more)
0
Line 6. You used UDim.new() instead of UDim2.new(). ProtectoidZ 42 — 5y
0
now i get 19:22:24.763 - Players.TheEdyGamerTroll23.PlayerGui.ScreenGui.TextButton.ok:4: attempt to call field 'Quart' (a userdata value) TheEdyGamerTroll23 15 — 5y
0
Youre assign a enum to other then !! SulaymanArafat 230 — 5y

2 answers

Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago

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

0
Thanks!, it worked perfectly! TheEdyGamerTroll23 15 — 5y
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. User#19524 175 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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)
0
ty dude! TheEdyGamerTroll23 15 — 5y
0
It is technically correct to use `Enum.` as the string names could be changed at any time by Roblox. unmiss 337 — 5y

Answer this question