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

"- Ram is not a valid member of Workspace" How can I fix that?

Asked by 4 years ago

Hello! I want to make an animation when equipped, for a test I made "print("Hello")" When I'm picking up the tool it says "Ram is not a valid member of Workspace" How can I fix that?

--Ram is a tool in a workspace

--Script: local function animation() game.Workspace.Ram.Equipped:Connect(function(mouse) print("A tool was equiped") end)

end animation()

0
*print("A tool was equipped")* AykoOfficial -6 — 4y
0
is ram in the workspace? danglt 185 — 4y
0
do you mean like ram as in how much ram the users device has on hand? I do not know for sure but I'm almost positive that you cant know that with the studio BRAEGON -8 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

I'm assuming you are using a local script? Local Scripts can only be run in certain places and the workspace is not one of them (unless it's in the player's character).

You can find out where they can run here.

Solution 1

Place the local script inside the tool and run Tool.Equipped using script.Parent to get the tool object.

script.Parent = Tool

script.Parent.Equipped:Connect(function()

end)

Solution 2

Make the script or local script stay in a place where it can only run once. That way it isn't re-running game.Workspace.Ram again (because once you pick the tool up it isn't parented to workspace anymore, rather it is parented to the character).

This can be in Player.PlayerScripts if it's a Local Script. game.Workspace or game.ServerScriptService if it is a Server Script

Ad

Answer this question