Working on a Small Project which revolves Billboard GUI (Inspiration from Watch Dog Game Series)

I am working on a game which is similar to WatchDog games series, I managed to make the gui (Simple heartlock gui) which was easy what I cant manage is the line which goes from the NPC to player some what like this

Heres what my code looks like

local function Hack(character)
	local torso = character:FindFirstChild("Torso")

	if torso then 
		local MarkerGui = torso:FindFirstChild("MarkerGui")
		if not MarkerGui then
			MarkerGui = Instance.new("BillboardGui", torso)
			MarkerGui.Name = "MarkerGui"
			MarkerGui.MaxDistance = 15
			MarkerGui.AlwaysOnTop = true
			MarkerGui.Size = UDim2.new(2, 0, 2, 0) -- Adjust size as needed
			MarkerGui.StudsOffset = Vector3.new(1, -0.2, 0) -- Adjust the offset to position near the heart

			local heartlock = Instance.new("ImageLabel", MarkerGui)
			heartlock.Size = UDim2.new(0.5, 0, 0.5, 0)
			heartlock.BackgroundTransparency = 1
			heartlock.Image = "rbxassetid://15295790200" -- Set your image ID here

		end
	end
end

for _, object in pairs(game:GetDescendants()) do
	if object:IsA("Model") and object:FindFirstChild("Humanoid") then
		Hack(object)
	end
end
1 Like

Heres what I achieved

Somehow managed to make it…


Heres how I did it…
I basically removed the script to create a billboard gui everytime, instead I added a Billboard Gui in the the NPC

I also added a ProximityPrompt (removed the CheckBox for ClickablePrompt) Beam (Attachment 0 is the attachment placed in the torso ) , added a script in StarterPlayerScripts named ProximityPrompt heres what i wrote

local PPS = game:GetService("ProximityPromptService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

function onPromptShown(Prompt)
	if Prompt.Name == "HackGUIPrompt" then
		local Beam = Prompt.Parent.Beam

		-- Attach the beam to the player's right hand
		local rightHand = LocalPlayer.Character:WaitForChild("RightHand")
		local beamAttachment = Instance.new("Attachment")
		beamAttachment.Parent = rightHand

		Beam.Attachment1 = beamAttachment

		local BeamTween = TweenService:Create(Beam.TransparencyValue, TweenInfo.new(0.1), {Value = 0})
		BeamTween:Play()

		local function Changed(Value)
			Beam.Transparency = NumberSequence.new(Value)
		end

		Beam.TransparencyValue.Changed:Connect(Changed)
	end
end

function PromptHidden(Prompt)
	if Prompt.Name == "HackGUIPrompt" then
		local Beam = Prompt.Parent.Beam

		local BeamTween = TweenService:Create(Beam.TransparencyValue, TweenInfo.new(0.05), {Value = 1})
		BeamTween:Play()

		local function Changed(Value)
			Beam.Transparency = NumberSequence.new(Value)
		end

		local function BeamTweenCompleted()
			Beam.Attachment1 = nil
		end
		BeamTween.Completed:Connect(BeamTweenCompleted)
		Beam.TransparencyValue.Changed:Connect(Changed)
	end
end

PPS.PromptShown:Connect(onPromptShown)
PPS.PromptHidden:Connect(PromptHidden)

what this script basically does is that it adds an attachment1 to the players RightHand when proximity prompt is shown.

Hope to keep updating on this game…

1 Like

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