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

Player not a Valid member of workspace?

Asked by 6 years ago

So I'm new to scripting on ROBLOX, and I'm trying to code a button to do a player animation, but keep running into an error saying player is not a valid member of workspace. I'm not sure how to fix it. Here is my LocalScript code:

script.parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer("01646611372")
end)

and here is my workspace code:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,animationID)
    local animation = Instance.new("Animation")
    animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationID

    local LoadedAnimation = game.Workspace(player.Name).Humaniod.LoadAnimation(animation)
    LoadedAnimation:Play()
end)

if I could get an answer to this, and an explanation as to what to do to prevent this in the future, I'd Really appreciate it. Thanks.

1 answer

Log in to vote
0
Answered by 6 years ago

Line 1 local script is script.Parent not script.parent

Line 5 server script is game.Workspace[player.Name] with square brackets

0
That worked, but now it's saying Loadanimation is not a member of "animation" Kralkkatorrik 0 — 6y
0
In the FireServer method in the LocalScript take off the first 0 in the ID. User#19524 175 — 6y
Ad

Answer this question