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

Why can't server Script find a part in Workspace?

I have a Tool called C4. When ever it explodes it sends a RemoteEvent called Explosion. Here is what it looks like:

game.ReplicatedStorage.Explosion:Connect(function (Player, HandleName)
	game.Workspace:WaitForChild(HandleName)
end)

Even though a Part named Handle exists in Workspace, it throws me this error:

Handle is not a valid member of Workspace "Workspace"

The only possible issue is that Handle is being created in a LocalScript.

Any Ideas?

2 comments

0

Is Explosion a Remote Event?

0

Yes NykoVania

1 answer

✓ Accepted answer

When RemoteEvents are fired from the client, detect them from the server using onServerEvent. Like this:


game.ReplicatedStorage.Explosion.OnServerEvent:Connect(function(Player, HandleName)
	game.Workspace:WaitForChild(HandleName)
end)

Furthermore, instances created from the Client cannot be seen by the Server, so you would have to create the Handle via a ServerScript

1 comment

0

Thanks!

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