I know how to script but not with remoteevents and stuff in mind. The animations and script will work in studio but not server/game

Here is how the tool is laid out:



Tool
    -Script
            -Local Script
    -Handle
    -Musket(Folder)
             -aniEvent
             -Animations
                      -Idle
                       -Reload
                        -Rest


Here is what is in the script



--------------------------------------------------

local aniEvent = script.Parent.Musket.aniEvent

--------------------------------------------------

local onKey = function(input)
	if input.KeyCode == Enum.KeyCode.R then
		return "Reload"
	elseif input.KeyCode == Enum.KeyCode.F then
		return "Rest"
	elseif input.KeyCode == Enum.KeyCode.C then
		return "Idle"
	end
end

script.Parent.Equipped:connect(function()
	
	for i,v in pairs(script:GetChildren())do
		v.Disabled = false
	end
	
	local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
	
	aniEvent:FireClient(player,script.Parent.Parent.Musket.Animations.Idle)
	
	game:service("UserInputService").InputBegan:connect(function(input)
		
		local action = onKey(input)
		
		if action ~= nil then
			aniEvent:FireClient(player,script.Parent.Parent.Musket.Animations:findFirstChild(action))
		end
		
	end)

end)

Here is local

--------------------------------------------------

local aniEvent = script.Parent.Parent.Musket.aniEvent

aniEvent.OnClientEvent:connect(function(animation)
	local track = game.Players.LocalPlayer.Character:findFirstChild("Humanoid"):LoadAnimation(animation)
	track:Play()
end)

--------------------------------------------------

My objective is to atleast to get animations running in game.>

1 comment

0

Animations dont need to be ran on a player differently when FE is enabled. Local Scripts will still work without any RemoteEvents/functions. NPCs are suppose to be animated with a script so no matter what you don't need Remotes to do animations.