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

How to fix workspace from thinking your calling a part?

WS = game:GetService("Workspace") PL = game:GetService("Players") LP = PL.LocalPlayer WS.LP.Torso:Remove()

I get "LP is not a vaild member Workspace" but I am trying to call the LocalPlayer name inside of workspace but It thinks im called a model or part called "LP" how do I fix it so it goes to LocalPlayer name?

2 answers

If you're trying to get the player's character (the model in the workspace), you'd use

workspace:FindFirstChild(LP.Name)

Or you can just use

LP.Character -- that would be the best way.

workspace is a global variable so you don't need to define it.

1 comment

0

Also :remove() is deprecated. Use :Destroy()

You could just write this line of code when referencing the local player in the workspace:

workspace[LP].Torso:Destroy() -- Using destroy because remove() is deprecated..

square brackets can also be used to reference an object that has a space in its name, for an example, we will use "scripting helpers". I'm not sure if this even needs an example, but just in case:

workspace["scripting helpers"] --[[ would call scripting helpers where as if you were to use a 		
                                                 space, it would error ]]

1 comment

0

Sorry about the comments, they always glitch out for me

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