Moving screen gui with player movement

Hey guys,
I’m trying to make a gui move with the players movement as seen in this game, Untitled FPS Game DEMO, I’m not sure how they did this so if anyone can help, please tell me!

Here’s a video if you dont want to join the game,

This would be done with a SurfaceGui and a part that you would position in front of players camera then delay it a bit so its slower than the camera:

local camera = workspace.CurrentCamera
local part = workspace.Part

local run = game:GetService("RunService")
local ts = game:GetService("TweenService")

run.RenderStepped:Connect(function(dt)
	ts:Create(part,TweenInfo.new(0.05),{CFrame = (camera.CFrame + camera.CFrame.LookVector*10)}):Play()
end)

This is a super simple example of the effect (keep in mind its not optimized at all). You would make a part in workspace, anchor it, make it non collidable and invisible, add a SurfaceGui to StarterGui and set its Adornee to the part. Now whatever you put into the SurfaceGui will be displayed on the part, and the code above will move the part in front of players screen with a bit of delay. You can achieve that with ScreenGui too but it would be a bit more complicated.

3 Likes

alright thanks for the response!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.