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

How to modify a tools "GripPos" ingame by script?

Asked by
RoboFrog 400 Moderation Voter
9 years ago

Alright, I'm trying to make a spear which will jab from scratch, but have encountered a bit of an issue -- how do I deal with "animating" a tool through the GripPos rotation options?

I'm currently using this as my script --

local debouncea = false
local gripos = script.Parent.GripPos

local damage = 55

script.Parent.Activated:connect(function()
    print("Running")
    if not debouncea then
        debouncea = true
        for i = 1,4 do
            print(i)
            gripos = CFrame.new(gripos.X, gripos.Y, (script.Parent.GripPos.Z + -.2))
            wait()
        end

        wait(.25)       

        for i = 1,4 do
            gripos = CFrame.new(gripos.X, gripos.Y, (script.Parent.GripPos.Z - -.2))
            wait()
        end

        debouncea = false
    end
end)

I'm not very good with tools, and the wiki lacked in-depth documentation on this subject. Chances are, I'm just approaching this the wrong way. This isn't doing anything (except the prints are just fine).

Thanks for reading, and I hope to find a solution!

1 answer

Log in to vote
3
Answered by
Muoshuu 580 Moderation Voter
9 years ago

The problem here is that when you are trying to change the 'gripos' you are only changing the variable, try script.Parent.GripPos = CFrame.new(gripos.X,gripos.Y,(script.Parent.GripPos.Z - -.2))

0
This specifically didn't give me the answer exactly, however, it led me down the right path to find it. Thanks! RoboFrog 400 — 9y
Ad

Answer this question