-
What do you want to achieve?
I need this script to show up for different players in a server -
What is the issue?
the animations dont show up on other peoples screens -
What solutions have you tried so far?
ive tried making a serverscript and useing remotevents too link the scripts but it didnt work
-- Services
local footsteps = require(game.ReplicatedStorage.FootstepModule)
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")
local playersService = game:GetService("Players")
-- Variables
local player = playersService.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local pcButton = Enum.KeyCode.LeftShift
local xboxButton = Enum.KeyCode.ButtonL3
-- Settings
local normalSpeed = 14
local sprintSpeed = 26
local normalFov = 70
local sprintFov = 80
local rcool = false
local lcool = false
-- Boolean
local running = script.Parent.Values.Running
-- Animation
local animation = script:WaitForChild("SprintAnim")
local sprintTrack = humanoid:LoadAnimation(animation)
-- // Functions
-- Camera tweening handler
local tween_fov = function(duration, value)
local fov_tween = tweenService:Create(camera, TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {FieldOfView = value})
fov_tween:Play()
return fov_tween
end
-- Input controller
userInputService.InputBegan:Connect(function(input, processed)
if input.KeyCode == (pcButton or xboxButton) and not processed and player.Stamina_Folder.Stamina.Value >= 1 then
script.AnimEvent:FireServer()
if humanoid.MoveDirection.Magnitude <= 0 then
running.Value = true
humanoid.WalkSpeed = sprintSpeed
else
running.Value = true
humanoid.WalkSpeed = sprintSpeed
sprintTrack:Play(0.25)
end
end
end)
userInputService.InputEnded:Connect(function(input, processed)
if input.KeyCode == (pcButton or xboxButton) and not processed and player.Stamina_Folder.Stamina.Value >= 1 then
script.AnimEndedEvent:FireServer()
running.Value = false
humanoid.WalkSpeed = normalSpeed
sprintTrack:Stop(0.25)
end
end)
-- Field of view controller
running.Changed:Connect(function()
if running.Value then
tween_fov(0.5, sprintFov)
elseif not running.Value then
tween_fov(0.5, normalFov)
end
end)
-- Main loop controller
runService.RenderStepped:Connect(function()
if running.Value then
-- Check if player is moving
if humanoid.MoveDirection.Magnitude <= 0 then
if sprintTrack.IsPlaying then
script.RenderStep.StopEvent:FireServer()
sprintTrack:Stop(0.25)
end
elseif humanoid.MoveDirection.Magnitude > 0 then
if not sprintTrack.IsPlaying then
script.RenderStep.PlayEvent:FireServer()
sprintTrack:Play(0.25)
end
end
-- Check if player is jumping
if humanoid.FloorMaterial == Enum.Material.Air then
if sprintTrack.IsPlaying then
script.RenderStep.FStopEvent:FireServer()
sprintTrack:Stop(0.1)
end
elseif humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.MoveDirection.Magnitude > 0 then
if not sprintTrack.IsPlaying then
script.RenderStep.PlayEvent:FireServer()
sprintTrack:Play(0.25)
end
end
end
end)
while wait(0.5) do
if running.Value == true and player.Stamina_Folder.Stamina.Value >= 1 then
player.Stamina_Folder.Stamina.Value = player.Stamina_Folder.Stamina.Value - 1
elseif player.Stamina_Folder.Stamina.Value <= 0 or running.Value == false then
script.CancelEvent:FireServer()
running.Value = false
character.Humanoid.WalkSpeed = 14
script.RenderStep.FStopEvent:FireServer()
sprintTrack:Stop()
end
end
if anyone know how to fix it that would be greatly appreciated.