Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to create a surface gui that rotates in the direction of the player?

At the moment I'm programming a game where you can talk to a dealer. For that i whould Like to have a Display that shows the text: press E to speak which always turns to the player so that it is always displayed correctly in the camera

local Trader = script.Parent.Trader.Trader.Position
local MainSystem = game.Workspace["Main System"]
local ShopID = script.Parent.ShopID.Value

wait ()
while true do
	wait ()
	local Childs = MainSystem.Player:GetDescendants()
	for i,v in pairs (Childs) do
		if v.Name == "Torso" or v.Name == "UpperTorso" then
			local DistanceToTorso = (Trader - v.Position).magnitude
			if DistanceToTorso < 15 then
				MainSystem.Events.OpenShopEvent:FireClient(ShopID)
				--Where I want to add the gui
			end 
		end
	end
end

Tutorials or the like would be very helpful :)

1 answer

✓ Accepted answer

I think instead of a surface gui what you are looking for ideally is a billboard gui. You can place this in the playerGui and attach it to a specific part with the Adornee property when the player's in close enough range. It will do all the rotating and positioning for you.

Hope I could help!

This discussion is preserved as it was. New answers, comments, and votes are closed.