Hello!
So i am wondering how do you make aiming animations with Player Arms visible on the Server?
Expected Behavior: (Sorry if mp4 is stretched)
Animations Play and Camera FOV Changes along with DepthOfField (This is the Client Version)
Actual Behavior:
Animations don’t work on the Server.
I have tried RemoteEvents, Functions, and i have no idea how to do it without it not being visible on the Server or Causing errors.
My Current Code on a LocalScript:
local GS = require(script.Parent.WeaponSetup) -- ModuleScript, stores all Animation Values + bools
MainClient = script.Parent.Client
A = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(GS.Client.Aim)
GS.IsActive = true
while GS.IsActive == true and GS.IsAiming == false do
wait()
GS.UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
GS.IsAiming = true
GS.TweenService:Create(GS.Camera, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {FieldOfView = 40}):Play()
GS.TweenService:Create(GS.Lighting.DepthOfField, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {FarIntensity = 1}):Play()
MainClient.Fire.AnimationId = GS.AimFireAnimation -- Replaces the Normal Shooting Animation with the Aiming Shooting Version
A:Play()
end
GS.UserInputService.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
GS.IsAiming = false
MainClient.Fire.AnimationId = GS.FireAnimation -- Replaces the Aiming Shooting Version with the Normal Shooting Version
GS.TweenService:Create(GS.Camera, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {FieldOfView = 120}):Play()
GS.TweenService:Create(GS.Lighting.DepthOfField, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {FarIntensity = 0}):Play()
A:Stop()
end
end)
end)
if GS.IsActive == false then
GS.Camera.FieldOfView = 120
A:Stop()
GS.IsAiming = false
break
end
script.Parent.Unequipped:Connect(function() -- Closes Aiming for when unequipping
GS.Camera.FieldOfView = 120
GS.Lighting.DepthOfField.FarIntensity = 0
GS.IsActive = false
GS.IsAiming = false
A:Stop()
MainClient.Fire.AnimationId = GS.FireAnimation
script.Enabled = false
end)
end
What I want is for the Players Animation to play on the Server, not the Client, Can you help?
All Replies are helpful!
Thanks.