Hey there!

So I'm trying to send an Instance over via an Remote Event, but all that the parameter outputs is nil. Is there any way I can fix this?

Local Script:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

script.Parent.MouseButton1Click:Connect(function()
	local playerModel = workspace:WaitForChild("ViewModel"..player.Name):WaitForChild("Player")
	local playerModelHumanoid = playerModel:WaitForChild("Humanoid")
	
	print(playerModelHumanoid)
	
	game.ReplicatedStorage:WaitForChild("PlayAnimations"):FireServer("LightSlashTwoHandBlade", playerModelHumanoid)
end)

Server Script:

game.ReplicatedStorage:WaitForChild("PlayAnimations").OnServerEvent:Connect(function(player, animation, model)	
	local animation = model:LoadAnimation(script:WaitForChild(animation))
	
	animation:Play()
end)

2 comments

0

I'm sure you already know, but animations for the local player can be played on the client and they will replicate to the server automatically.

0

Also, I don't think humanoids can use :LoadAnimation(), it's deprecated.