Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Player not a Valid member of workspace?

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

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

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

2 comments

0

That worked, but now it's saying Loadanimation is not a member of "animation"

0

In the FireServer method in the LocalScript take off the first 0 in the ID.

This discussion is preserved as it was. New answers, comments, and votes are closed.