Hello! So, I tried to make an extending bridge system for my game, it works like this - through a placement system, you place a box. From the box, a part that is the bridge expands outside the box.
This is how it works:
However, whenever the box is turned during the placement, this happens:
I kinda understand why that happens, but how do I make it work on every axis? Here is the script…
script.Parent.Start.Changed:Connect(function(changedval)
if changedval == true then
wait(0.1)
local cData
for i,v in pairs(settingsModule.GetData("Bridge")) do
if v["Name"] == script.Parent.CurrentTrap.Value then
cData = v
end
end
local info = TweenInfo.new(
0.5,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local currentLength = cData["Length"]
script.Parent.PartToTween.Transparency = 0
local goals = {
Size = Vector3.new(script.Parent.PartToTween.Size.X,script.Parent.PartToTween.Size.Y,(script.Parent.PartToTween.Size.Z+currentLength));
}
local posGoals = {
Position = Vector3.new(script.Parent.PartToTween.Position.X,script.Parent.PartToTween.Position.Y,(script.Parent.PartToTween.Position.Z-(currentLength/2)));
}
local changeSizeTween = tweenService:Create(script.Parent.PartToTween, info, goals)
local changePosTween = tweenService:Create(script.Parent.PartToTween,info,posGoals)
changeSizeTween:Play()
changePosTween:Play()
end
end)
I tried to look for something like this on devforum and youtube, but couldn’t find anything like this. I also tried to use part:Resize() , but that just did the same thing except without tweening.