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

How to update BillboardGui on player interaction?

Asked by
TechModel 118
3 years ago

How do I make the text change when interact with a part with proximity prompt? I'm using a remote event, not sure if that's a good way to do it becuase I want the player to send a event to the script in server script service and change the players BillboardGui above it's head. The purpose is to interact with this part and it changes the Gui over it's head, showing its action like "Busy" or "Working..." and after 10 seconds waiting, it reverts back to "Idle".

I'm really still learning on remote events so don't get me wrong. I want it to affect the player interacting and changing the BillboardGui above its head, WHICH shows everyone the effect.

Script in ServerScriptService:

local overhead = script.HeadGui:Clone()
local clone = script.HeadGui:Clone()

game.Players.PlayerAdded:Connect(function(plr)
    clone.Parent = game.Workspace:WaitForChild(plr.Name).Head
    clone.NameText.Text = plr.Name

    plr.CharacterAdded:Connect(function()
        clone.Parent = game.Workspace:WaitForChild(plr.Name).Head
        clone.NameText.Text = plr.Name
        end)
    end)

game.ReplicatedStorage.HeadRem.OnServerEvent:Connect(function(plr)
    local One = "Busy..."
    local Two = "Working..."
    clone.ActionText = math.random(One, Two)
    clone.TextColor3 = Color3.fromRGB(255, 0, 0)
    wait(10)
    clone.ActionText = "Idle"
    clone.TextColor3 = Color3.fromRGB(85, 255, 127)
    clone.Parent = plr
end)

Script in Part:

local prox = script.Parent.ProximityPrompt

prox.Triggered:Connect(function()
    game.ReplicatedStorage.HeadRem:FireAllClients()
end)

Answer this question