I am trying to make a part grow every time it’s position moves one stud in the Y Axis. (Ex: Player moves a part one stud in the Y Axis, the part will grow by an increment)
The main issue is that when the client moves the part (a sphere) up a ramp, the part will not change its size. But, when the server moves the part, it grows correctly in the client’s perspective.
However, what I’ve found while testing is, if you anchor the part on the client and you move it up it DOES work! That might give some ideas
I think the issue has something to do with the fact that the part is unanchored, since it only works when it is anchored (and moving the part with the move tool sort of realigns the part as if it was anchored…)
(Local Script) :
local part = workspace:WaitForChild("Sphere")
local initialSize = part.Size.X
local sizeIncrement = 0.01
local lastPositionY = part.CFrame.Y
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.Remotes.UpdateOwnership:FireServer(part)
part:GetPropertyChangedSignal("Position"):Connect(function()
wait(.1)
local newY = part.CFrame.Y
local deltaY = newY - lastPositionY
if math.abs(deltaY) >= 1 then
local currentSize = part.Size.X
local newSize = currentSize + sizeIncrement
part.Size = Vector3.new(newSize, newSize, newSize)
lastPositionY = newY
end
end)
end
end)