Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Im trying to make a cite script, but im stuck on making sure the player is close enough?

Asked by 4 years ago

I want to make it so, when the player is atleast 5 studs from another player, the other player will have a surfacegui pop up on his torso, and If they click (e) then another gui pops up but I am stuck on the magnitude part

function findPlayer()
    for i, v in pairs(game.Players:GetChildren()) do
        if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).magnitude <= 5 then
            return v.Character
        end
    end 
end

while true do
    wait(0.05)
    if findPlayer() then

    end
end
0
Try CFrame instead of Position. SmartNode 383 — 4y

Answer this question