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

How do I return something in quotation marks?

Here is my script

local function GetClosestPlayer()
    local LowestDistance = math.huge
    local ClosestCharacter = nil
    local Characters = {}
    for i,v in pairs(game:GetService("Players"):GetPlayers()) do
        if v.Character ~= nil and v ~= game.Players.LocalPlayer then
            table.insert(Characters, v.Character)
        end
    end
    for i,v in pairs(Characters) do
        if v ~= nil then
            if v:FindFirstChild("HumanoidRootPart") then
                local InitialDis = (v.HumanoidRootPart.Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
                local Ray = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * InitialDis)
                local Part,Position = game.Workspace:FindPartOnRay(Ray, game.Workspace)
                local FinalDifference = math.floor((Position - v.HumanoidRootPart.Position).magnitude)
                if FinalDifference < LowestDistance then
                    ClosestCharacter = v
                    LowestDistance = FinalDifference
                end
            end
        end
    end
    local ClosestPlayer = game.Players:GetPlayerFromCharacter(ClosestCharacter)
    if ClosestPlayer ~= nil then
        return ClosestPlayer.name
    end

I want to return ClosestPlayer.name as a string so that I can print their name. Please help!

1 answer

message = "he said \"bye\" and left"
print (message

Please tell me if this answer works. If it does, don't forget to upvote it :P

4 comments

0

Huh? I think you misunderstood my question.

0

What did you want your question to be?

0

I was wondering how to return something in quotation marks so that I can print it, is it possible?

0

k

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