I want the aim animation to play when holding the RM button and stop when released.
Video shows the issue
I’ve looked on the developer forum but nothing works…
local mouse = game.Players.LocalPlayer:GetMouse()
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local g = workspace.CurrentCamera:WaitForChild("m1")
local e = game.StarterPlayer.StarterCharacterScripts.m1
local value = g:WaitForChild("Aiming")
local tweenInfo = TweenInfo.new(1)
local anim = g.Animation:LoadAnimation(g.e)
local part = workspace.CurrentCamera
local m = false
mouse.Button2Down:Connect(function()
print("hold")
m = true
local goal = {}
goal.FieldOfView = 60
while m == true do
wait()
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
anim:Play()
end
end)
mouse.Button2Up:Connect(function()
m = false
if m == false then
local goal = {}
goal.FieldOfView = 70
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
end
anim:Stop()
print("released")
end)
Ask me if you need the rbxl