|||
|---|---|
||local inven = script.Parent:WaitForChild(Inventory)|
|||
||local TweenService = game:GetService(TweenService)|
||local TweenInfo1 = TweenInfo.new(1, Enum.EasingStyle.Bounce , Enum.EasingDirection.InOut) |
||-- i want it the same speed no matter how far it is or close|
||local pos1 = {UDim2.new{0.338, 0,0.673, 0}}|
||local pos2 = {UDim2.new{0.338, 0,2, 0}}|
||local GuiTween = TweenService:Create(inven, TweenInfo1, {Position = pos1})|
||-- i want it the same speed no matter how far it is or close|
||local GuiTween2 = TweenService:Create(inven, TweenInfo1, {Position = pos2})|
and its giving me an error saying
TweenService:Create property named ‘Position’ cannot be tweened due to type mismatch (property is a ‘UDim2’, but given type is ‘Array’) - Client - Manager:158
First off, the service in :GetService() should be a string, but as long as it works its okay, but the problem is that you put the positions in a table, causing it to give you that error, either remove the brackets, or do something like this:
local GuiTween = TweenService:Create(inven, TweenInfo1, {Position = pos1[1]})|-- Replace 1 with your index in the table.
The script contained several syntax errors, which have been corrected as follows:
local inven = script.Parent:WaitForChild("Inventory")
local TweenService = game:GetService("TweenService")
local TweenInfo1 = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut)
local pos1 = UDim2.new(0.338, 0, 0.673, 0)
local pos2 = UDim2.new(0.338, 0, 2, 0)
local GuiTween1 = TweenService:Create(inven, TweenInfo1, {Position = pos1})
local GuiTween2 = TweenService:Create(inven, TweenInfo1, {Position = pos2})
-- To run the tweens, use GuiTween1:Play() and GuiTween2:Play() as needed
The EasingStyle should be changed to Linear to ensure a constant speed, regardless of the distance.