The question explains it badly, but I have a script where it looks for a certain part in Workspace, but it needs to use a variable to find it, rather than just naming it.
script.Parent.MouseButton1Down:connect(function()
local d = script.Parent.loc.Value
local s = Instance.new("Sound")
s.SoundId = "rbxasset://138811664"
s.Parent = game.Players.LocalPlayer.Character.Torso
s:Play()
game.Players.LocalPlayer.Character.Torso.CFrame = game.Workspace.Presets.d.CFrame + Vector3.new(0,4,0)
wait(2)
s:destroy()
end)
In this instance I'm looking for "d," in game.Workspace.Presets, but how would I do this so it looks for the variable rather than an object named "d"?

1 comment
If you mean look for the Part that the Value's value is, game.Workspace.Presents:FindFirstChild(script.Parent.loc.Value)