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

Tool grip animation does not function?

Asked by 10 years ago

I have a tool and when a player presses a button the tool will change it's position, but the tool will only move in one direction and will not head back to it's original spot.

Function moves tool to it's new spot and records the positions in two arrays

local gripPosArray = {}
local gripRightArray = {}

function scopeAnimationTo()
    for i = 1, 20 do
        wait()
        script.Parent.GripPos = script.Parent.GripPos + Vector3.new(0,0,-.025)
        table.insert(gripPosArray,i,script.Parent.GripPos)
        script.Parent.GripRight = script.Parent.GripRight + Vector3.new(0,0,-.1)
        table.insert(gripRightArray,i,script.Parent.GripRight)
    end
    print(script.Parent.GripPos)
end

Function moves the tool back to origin using the array positions

function scopeAnimationFrom()
    for i = 1, 20 do
        wait()
        script.Parent.GripPos = gripPosArray[20-i]
        print(script.Parent.GripPos)
        script.Parent.GripRight = gripRightArray[20-i]
    end
    print(script.Parent.GripPos)
end


0
Could you supply the arrays in your script as well? Are you ever calling this function? And is this a localscript? Goulstem 8144 — 10y
0
This is in a regular script so it won't clash with filtering enabled, these functions are called whenever a person right clicks CaptainRuno 40 — 10y
0
Could you supply the arrays in your script please. Goulstem 8144 — 10y
0
I feel really dumb, I forgot to change a boolean after the "scopeAnimationTo" so it kept running, sorry for wasting your time. CaptainRuno 40 — 10y

Answer this question