so i made a ragdoll system, and i am gonna name the ragdoll like this:
ragdoll.Name = ""..char.Name.."1"
no problem right, but when i want to get the ragdoll’s position from the server, i am a little bit stomped.
i tried to to this but it tried to find “ames” which is a varible
local ame = ""..char.Name.."1"
local clone = game.ReplicatedStorage.Drop:Clone()
clone.Parent = game.Workspace
clone.Position = game.Workspace.ame.Head.Position
You’re trying to use the variable to dot index the workspace so yes it’d try to find “ame” instead. You want this to evaluate to whatever the ame variable is pointing to instead - use square brackets to index the workspace instead so it resolves to the value of ame.
game.Workspace[ame].Head.Position
I don’t really support indexing workspace by certain names like this, I think you should just have the model reference on hand somewhere, but that’s a story for another time irrelevant to this scenario. Don’t have enough context to go at lengths about good practice as a side note.
That’s not enough context for me to understand your problem. I could think of a number of issues as to why you’d get an error for this, such as a race condition (whatever code is here is running before the name script runs) or the model doesn’t actually exist. Those are things you need to debug your code for. If you’re looking for help from others, you need to provide detailed context – screenshots would additionally help. Just reading an error isn’t enough.