Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I get an error everytime I try to get an Instance via RemoteEvent?

Asked by 3 years ago

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)
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. radiant_Light203 1166 — 3y
0
Also, I don't think humanoids can use :LoadAnimation(), it's deprecated. radiant_Light203 1166 — 3y

Answer this question