Some animations I have won't load. This is an example of an animation. I put it in the StarterGear and it's supposed to give you 2 money every time it plays-- the error isn't in that part, since I removed the adding money part and it still didn't load.

I even tried adding a wait-- still the same problem.

A LocalScript inside the animation:

repeat wait() until game.Players.LocalPlayer.Character ~= nil

local moneyModule = require(game:GetService("ReplicatedStorage").Modules:WaitForChild("addMoneyModule"))
anim = script.Parent.Animation
tool = script.Parent
p = tool.Parent.Parent
mouse = p:GetMouse()
c = p.Character
LoadAnim = c.Humanoid:LoadAnimation(anim)
debounce = false

CoolDown = 0



function PlayAnim()
	LoadAnim:Play()
	wait(CoolDown)
	moneyModule.addMoney(script.Parent.addMoneyAmount, game.Players.LocalPlayer)
	debounce = false
end

function OnSelect(mouse)
	mouse.Button1Down:connect(function()
		if debounce == false then
			debounce = true
			PlayAnim()
		end
	end)
end

tool.Selected:connect(OnSelect)

13 comments

2

You can't access the ServerScriptService from a local script.

0

So how should I access it? Should I just move the modulescript to replicatedstorage?

0

Alright, I moved it to ReplicatedStorage & it's still not loading.

0

Yes that would be the best place for it, though requiring a ModuleScript from the client, in my experience, only executes the ModuleScript on the client. I think you would have to call the server via RemoteEvent and then have the server execute it.

0

So I'd FireServer? (New to FE). Also, that doesn't fix the animation loading even if it does fix the money being added.

0

You would need to have the server play the animation aswell, and yes you would Fire the server, here's a helpful link: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

0

Would I have to change all the variables accessing the Player (game.Players.LocalPlayer)?

0

did you make the animations for R6 or R15?

0

r6 ^

0

well that's the error i think

0

if its r6, you need to make sure your players are r6 too (same goes for r16) ~ i think

0

I switched it and it still says failed to load

0

did you make it so characters load in as r6 when they join the game? if you did and it didn't work, then idk :/