I am trying to find make a Image label follow a part and i scrolled through Devforum and i didn’t find any solutions. The part is very massive and it’s located at 0, 0, 0.
Try this, MUST be in a local script or use RemoteEvents to send the data.
local part = --location to part
local camera = workspace.CurrentCamera
local worldPoint = part.Position
local vector = camera:WorldToScreenPoint(worldPoint)
local screenPoint = Vector2.new(vector.X, vector.Y)
local depth = vector.Z
Set the position from the screenPoint, I think you should use the offset in the UDim2 part, use runService so you can move it smoothly.
local RemoteEvent = game.ReplicatedStorage.SunShineEvent
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local ScreenGui = game.StarterGui.ScreenGui
local SunTexture2 = game.StarterGui.ScreenGui.ImageLabel
RemoteEvent.OnServerEvent:Connect(function(player, part)
RunService.Heartbeat:Connect(function()
local Camera = game.Workspace.Camera
local part = part
local camera = workspace.CurrentCamera
local worldPoint = Vector3.new(0, 0, 0)
local vector = camera:WorldToScreenPoint()
local screenPoint = UDim2.new(0, vector.X, 0, vector.Y)
local depth = vector.Z
SunTexture2.Size = UDim2.new(0,30,0,30)
SunTexture2.Position = screenPoint
end)
end)
-- This is the remote event local script
-- I also added the screeengui and the texture to the game because generating didn't work for me
SunShineEvent:FireServer(Star)
-- This is inside a MODULE script
Also In the last reply i went into the server not the in the client, so it probably was at 0, 0, 0 but the part wasn’t there.