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

How do I fix "RemoteEvent is not a valid member of ReplicatedStorage"?

I am trying to make an animation play when I click using my tool I have created. I have two scripts. One script is a local script. It is inside the tool, which is inside the starterpack. Here is the script:

script.Parent.Activated:Connect(function()
	game.ReplicatedStorage.RemoteEvent:FireServer(2063032185)
end)

The second script is a regular script inside of the Workspace. Here it is:

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].Humanoid:LoadAnimation(animation)
	loadedAnimation:Play()
end)

According to the tutorial I watched, this should load my animation. When I click using the tool, in the output I get the error message "RemoteEvent is not a valid member of Replicated Storage". Can anyone help fix my problem?

2 answers

✓ Accepted answer

The RemoteEvent doesn't exist in ReplicatedStorage. It's probably in a folder or another object.

2 comments

1

Or maybe he has two events named "RemoteEvent"

0

We figured out that I never created a RemoteEvent in the first place :P

Hmmmm, you could also use

game.ReplicatedStorage:WaitForChild("RemoteEvent"):FireServer()

WaitForChild is always important!!

2 comments

0

not necessarily

0

waitforchild can act like a normal function and get the child, or act as a yield function and yield the current thread until the child is returned. if the child isn’t found and the second argument isnt specified, it errors

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