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

How do I get the Tool Grip Properties to Update?

Asked by 4 years ago

Starting Image I am trying to get a gun system in place, and in this system I update the tool grip properties like so:

    tool.Equipped:Connect(function(mouse)
        if tool:FindFirstChild('GunStats') ~= nil then
            r15rifleidle:play()

            Remotes.Weld:FireServer('make', CurrentChar.RightHand, CurrentChar.RightHand, tool.Handle, 'HandWeld')
            Remotes.SetP:FireServer(tool.Name, {
                ["GripPos"] = Vector3.new(0, 0, -0.562),
                ["GripUp"] = Vector3.new(0, 0.026, -1)
            })

            UsingGun = true
        end
    end)

But whenever I try to update the tool grip properties on runtime, for example when I press the sprint keybind.

keybinds['_runkeybind'] = keybind:new(Enum.KeyCode.F, function(flag, self_name)
    local self_struct = keybinds[self_name]

    if self_struct.variables['before_run_speed'] == nil then
        self_struct.variables['before_run_speed'] = 16
    end

    keybinds['_crouchkeybind']:call(false)

    if flag then
        CurrentChar.Humanoid.WalkSpeed = 19

        if UsingGun then
            local tool = CurrentChar:FindFirstChildOfClass('Tool')
            --Remotes.Weld:FireServer('remove', CurrentChar.RightHand, CurrentChar.RightHand, tool.Handle, 'HandWeld')
            Remotes.Weld:FireServer('remove', CurrentChar.RightHand, CurrentChar.RightHand, tool.Handle, 'RightGrip')

            --Remotes.TogP:FireServer(CurrentChar.RightHand, 'Transparency', 1)

            --Remotes.Weld:FireServer('make', CurrentChar.UpperTorso, CurrentChar.UpperTorso, tool.Handle, 'TorsoWeld')

            if r15rifleidle.playing then
                r15rifleidle:stop()
            end

            Remotes.SetP:FireServer(tool.Name, {
                ["GripPos"] = Vector3.new(0, 0, 0),
                ["GripUp"] = Vector3.new(0, 0, 0)
            })

            r15sprint:play()
        end

The result is shown here: Sprint Image

Thing's I have tried: - Checking if anything is happening after the call to offset the change back to the original settings. (Result: Nothing) - Updating the grip on heartbeat (Result: Nothing)

1 answer

Log in to vote
0
Answered by 4 years ago

Because RightGrip replication is kind of weird you would have to re-equip your tool after updating any property/setting in the Tool object.

Ad

Answer this question