Let’s say I am trying to make a saber and want it to be activated which can be done by resizing the light part by doing that I need to tween it. But when I do that it resizes in both directions instead in 1. How can I possibly fix that?
Here is the script that could possibly be useful:
local Tool = script.Parent.Parent
local Saber = Tool.Saber
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Handle = Tool.Handle
local Tween = game:GetService("TweenService")
local Info = TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false
)
local ActivatedTable = {
Size = Vector3.new(Saber.Position.X + 5, 0, 0)
}
local DeActivatedTable = {
Size = Vector3.new(0.3, 0.3, 1.5)
}
local ActivatedTween = Tween:Create(Saber, Info, ActivatedTable)
local DeActivatedTween = Tween:Create(Saber, Info, DeActivatedTable)
Tool.Equipped:Connect(function()
Player.PlayerGui.SaberControls.Enabled = true
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
print("Opening")
ActivatedTween:Play()
end
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print("Closing")
DeActivatedTween:Play()
end
end)
end)
end)
Tool.Unequipped:Connect(function()
Player.PlayerGui.SaberControls.Enabled = false
end)