I am trying to get "found"'s torso to be teleported to a spawnpoint, but "found" is a variable for player! here is my script
found = workspace:findFirstChild(script.Parent.Parent.Parent.Parent.Name) while true do wait(0.1) Workspace.found.Torso.CFrame = CFrame.new(Workspace.Spawners.WhiteSpawn.Position + Vector3.new(0, 2, 0))
Please help!!! Thank you!!! P.S. This is not the full script, as I do not the rest of the script is the problem
I'll assume that you do define found
somewhere in the script and it equals some Player object. Your problem is the dots.
In Roblox, the dot (.
) searches for a child or property by name. If you have a Part in workspace named "Part", you can access it easily;
workspace.Part
while if it's named "LaParte" you must access it with this new name.
workspace.LaParte
When going through hierarchies with dots, Roblox ignores any variable that might match the name, and searches normally.
local base = workspace.BasePlate print(workspace.base) --> error: base is not a valid member of workspace
and even,
local base = workspace.BasePlate.Name print(workspace.base) --> error: base is not a valid member of workspace
When using dots, all variables are irrelevant.
If found
equals a Player object, you can simply use the Character
property owned by all Players.
found.Character