Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help with my script sort of lagging when i first use it?

Asked by 3 years ago
Edited 3 years ago

When i first use the script it will basically ignore the waits,

https://cdn.discordapp.com/attachments/858883431231520800/874832959700631602/confusion.mp4

This happens in studio and real game, Idk how to fix it so can someone please help.

(The script is in a local script form but it still does the same in a script)

local Player = game.Players.LocalPlayer
local Character = Player.Character

local Mouse = Player:GetMouse()

local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")

local ReplicatedStorage = game:GetService("ReplicatedStorage")

Mouse.Button1Down:Connect(function()
    local Character = Player.Character

    local effectFolder = game.Workspace:FindFirstChild(Player.Name.." Effects") or Instance.new("Folder", workspace)
    effectFolder.Name = Player.Name.." Effects"

    local JP = Character.Humanoid:LoadAnimation(script.JP)
    local RP = Character.Humanoid:LoadAnimation(script.RP)
    local JPL = Character.Humanoid:LoadAnimation(script.JPL)

    Character.HumanoidRootPart.Anchored = true

    JP:Play()
    wait(JP.Length)
    JPL:Play()

    local Arm = script.SmoothCube:Clone()

    Debris:AddItem(Arm, 4)

    Arm.BrickColor = Character["Right Arm"].BrickColor
    Arm.Size = Character["Right Arm"].Size + Vector3.new(.01, .01, .01)
    Arm.CFrame = Character["Right Arm"].CFrame * CFrame.new(0, -1.5, 0)
    Arm.Parent = effectFolder

    TweenService:Create(Arm, TweenInfo.new(2.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = Arm.Size + Vector3.new(0, 100, 0), CFrame = Arm.CFrame * CFrame.new(0, -50, 0)}):Play()
    wait(2.5)   
    TweenService:Create(Arm, TweenInfo.new(1.5, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {Size = Arm.Size + Vector3.new(0, -102, 0), CFrame = Arm.CFrame * CFrame.new(0, 51.5, 0)}):Play()
    wait(1.5)

    for i,v in pairs(Character.Humanoid:GetPlayingAnimationTracks()) do
        if v.Name == "JPL" then
            v:Stop()
        end
    end

    RP:Play()
    Character.HumanoidRootPart.Anchored = false
end)
0
Can you please include your code directly on your post? appxritixn 2235 — 3y
0
just postedit HolySloth17 0 — 3y

Answer this question