#[SOLVED] Custom item 'ESP'

1 messages · Page 1 of 1 (latest)

polar fjord
#

wanted to make custom item ESP for my game, and cant understand why position of the frame is being dragged down from the object position, its like frame is under the object, even though i want it to be exactly where object is?
Here's my local script:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local hud = player.PlayerGui:FindFirstChild("Hud")
if not hud then
    hud = Instance.new("ScreenGui")
    hud.Name = "Hud"
    hud.Parent = player.PlayerGui
end

local esp = hud:FindFirstChild("ESP")
if not esp then
    esp = Instance.new("Frame")
    esp.Name = "ESP"
    esp.Size = UDim2.new(1, 0, 1, 0)
    esp.BackgroundTransparency = 1
    esp.Parent = hud
end

local frame : Frame = esp:FindFirstChild("Frame")
if not frame then
    frame = Instance.new("Frame")
    frame.Name = "Frame"
    frame.Size = UDim2.new(0, 50, 0, 50)
    frame.BackgroundTransparency = 1
    frame.Visible = false
    frame.AnchorPoint = Vector2.new(.5, .5)
    frame.Parent = esp
end

local target = game.Workspace:FindFirstChild('items'):GetChildren()[7]

RunService.RenderStepped:Connect(function()
    if target and frame then
        local targetPos
        if target:IsA("Model") then
            targetPos = target.PrimaryPart and target.PrimaryPart.Position or target:GetBoundingBox().Position
        elseif target:IsA("BasePart") then
            targetPos = target.Position
        end

        if targetPos then
            local screenPos, onScreen = camera:WorldToViewportPoint(targetPos)
            if onScreen and screenPos.Z > 0 then
                frame.Position = UDim2.fromOffset(screenPos.X, screenPos.Y)
                frame.Visible = true
            else
                frame.Visible = false
            end
        else
            frame.Visible = false
        end
    end
end)

#

i dont want to use BuildBoardGui on item, i just want to use Frame inside of Player gui so if someone could help i would really appreciate it

sleek sail
polar fjord
#

tried

polar fjord
sleek sail
sleek sail
polar fjord
#

okay you were right

#

it was anchor point

#

idk why

#

now it looks like this

#

anyways, thank you

sleek sail
#

you may have inset issues

sleek sail
sleek sail
#

yea

polar fjord
#

thanks

#

[SOLVED] Custom item 'ESP'

polar fjord
# sleek sail np

well, i thought its working but its not, its dragging it down again

sleek sail
#

this might be your offset