Why my animation doesn’t works?, is it problem of my script or my animation, it doesn’t moves In-Game, just rotates
animation In Studio :
https://gyazo.com/b2b5d64e92da87f3d43b55e1edfab6d7
In- game :
https://gyazo.com/de05d05cb059791523f0fd905db607ea
My script :
task.wait(0.1)
local replicated = game:GetService("ReplicatedStorage")
local event = replicated:WaitForChild("UseFlashlight")
local db = false
local db2 = false
local plr
local animation = script:WaitForChild("On")
local flashlight = script:WaitForChild("Flashlight")
event.OnServerEvent:Connect(function(client, key)
if(key == Enum.KeyCode.F) then
plr = client
local char = plr.Character
local RightArm = char:WaitForChild("Right Arm")
local humanoid = char:WaitForChild("Humanoid")
if not db2 then
db2 = true
if not db then
db = true --
local fclone = flashlight:Clone()
fclone.Parent = char
local motorweld = Instance.new("Motor6D")
motorweld.Parent = RightArm
motorweld.Part0 = RightArm
motorweld.Part1 = fclone
local anim = humanoid:LoadAnimation(animation)
anim:Play()
print("On For "..char.Name)
task.wait(1.5)
db2 = false --
else
db = false
print("Off For "..char.Name)
local anim2 = humanoid:LoadAnimation(animation)
anim2:Play()
anim2.Stopped:Connect(function()
if char:FindFirstChild("Flashlight") then
local f = char:WaitForChild("Flashlight")
f:Destroy()
end
end)
task.wait(1.2)
db2 = false --
end;
end;
end;
end);