Hey there! I was wondering if there was a way that I can make the part scale only in the direction (kinda like anchor point for GUI’s) I’m telling it to scale, instead of both directions.
What I don’t want:
What I want:
Code:
local RS = game:GetService("ReplicatedStorage")
local Remotes = RS.Remotes
local resize = Remotes.Resize
local increment = 0.5/2
local oldSize = Vector3.new()
local oldCFrame = CFrame.new()
resize.OnClientEvent:Connect(function(target, set, face, distance)
if set then
oldSize = target.Size
oldCFrame = target.CFrame
else
local Dist = math.round(distance/increment)*increment
target.Size = oldSize+oldSize*Vector3.FromNormalId(face)*Dist
end
end)
local RS = game:GetService("ReplicatedStorage")
local Remotes = RS.Remotes
local resize = Remotes.Resize
local increment = 0.5/2
local oldSize = Vector3.new()
local oldCFrame = CFrame.new()
resize.OnClientEvent:Connect(function(target, set, face, distance)
if set then
oldSize = target.Size
oldCFrame = target.CFrame
else
local Dist = math.round(distance/increment)*increment
target.Size = oldSize+oldSize*Vector3.FromNormalId(face)*Dist
-- target.Position += target.Size/2 -- ???
end
end)
What you can do is: Have a origin position aka before scaling the part then have a offset aka the size kinda stuff than add the offset in the origin and set it to the target position.