#Gui Elements being moved gets slower over time (Deltarune Ch 3 Spoilers)

1 messages · Page 1 of 1 (latest)

tulip inlet
#

So I made a Deltarune Battle System and for some reason, every turn makes the soul and the projectiles go slower. I tested to make sure it wasn't if the battle was active over time and it wasn't. The projectiles do get deleted whenever they reach the bottom of the screen or the enemy's turn ends

#

Projectile Script

local battleSystem = script.Parent.Parent.Parent.Parent.BattleSystem
local battlebox = script.Parent.Parent
local soul = battlebox.Soul
local grazeCooldown = 0
local yVel = 0

while task.wait() do
    grazeCooldown -= 1
    if script.Parent and (soul.AbsolutePosition - script.Parent.AbsolutePosition).Magnitude < 20 then
        if battleSystem.InvisFrames.Value <= 0 then
            game.Players.LocalPlayer.Character.Humanoid.Health -= 10
            battleSystem.InvisFrames.Value = 50
            game.SoundService.Damage:Play()
        end
        script.Parent:Destroy()
    end
    
    if script.Parent and (soul.AbsolutePosition - script.Parent.AbsolutePosition).Magnitude < 50 then
        if battleSystem.InvisFrames.Value <= 0 and grazeCooldown <= 0 then 
            battleSystem.TP.Value += 1
            soul.Graze:Play()
            soul.GrazeArea.ImageTransparency = 0
            grazeCooldown = 100
        end
    end
    
    if script.Parent and battleSystem.PlayerTurn.Value or script.Parent and script.Parent.Position.Y.Scale > 1.43 then
        script.Parent:Destroy()
    end
    yVel += 0.00005
    if script.Parent then
        script.Parent.Position += UDim2.new(0,0,yVel,0)
    end
end
fossil grail
#

Make sure that the spawning script does not edit a value outside of the function

tulip inlet
#

this is the spawn portion of the BattleSystem script

if attack.Value == 1 then
  local dropClones = 0
  repeat
      local clone = script.Drop:Clone()
      clone.Parent = battlebox
      clone.LocalScript.Enabled = true
      clone.Position = UDim2.new(math.random(0,900)/1000,0,-0.31,0)
      dropClones += 1
      wait(0.1)
      clone = nil
    until dropClones >= 95
end
tulip inlet
#

I tried changing everything to just wait() instead of task.wait() since task.wait() is fps based but it was still slowing down

fossil grail
#

Very weird

#

Might be a lag issue theb

#

Try lowering the spawn rate and see

tulip inlet
#

alright

tulip inlet
# fossil grail Might be a lag issue theb

i don't think it would be a spawn issue since when the projectile reaches the bottom of the screen or the player's turn ends then the projectile would get destroyed

fossil grail
#

Yh i dont think so too but

#

You never know

tulip inlet
#

i actually increased the spawn rate and the lag still started at the same time it usually did

tulip inlet
scenic aspen
tulip inlet