I have a script that drops a blue part from the sky, it uses a raycast to check the distance between the part and the distance between ground. Once it reaches a certain distance, the part will be anchored. Well it works fine, but for some reason the server and client are seeing different things. Notice how on the client the balls are up in the sky, while on the server its low on the ground.
CLIENT
SERVER
local RS = game.ReplicatedStorage
local debris = game.Debris
local powerupDrop = workspace.PowerupDrop
while wait(1) do
local offset = Vector3.new(math.random(-500, 0), 300, math.random(-45, 45))
local powerup = RS.Powerups.Freeze:Clone()
powerup.Position = powerupDrop.Position + offset
powerup.Parent = workspace
debris:AddItem(powerup, 60)
repeat
local rayOrigin = powerup.Position
local rayDirection = Vector3.new(0, -300, 0)
local raycastResult = workspace:Raycast(rayOrigin, rayDirection)
if raycastResult then
print(powerup.Position.Y)
distFromGround = (powerup.Position.Y - raycastResult.Position.Y)
print(raycastResult.Instance.Name)
print(distFromGround)
wait()
end
until distFromGround <= 2
powerup.Anchored = true
end