Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by
EgoMoose 802 Moderation Voter
5 years ago

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!

Ad

Answer this question