Hello.
So, I’m trying to create something in the workspace, which when activated will change an element on the players UI, such as text. Does anyone know how to do this?
Hello.
So, I’m trying to create something in the workspace, which when activated will change an element on the players UI, such as text. Does anyone know how to do this?
Make a Button In Workspace and Insert a Click Detector to It and Detect when its Clicked .ClickDetector DevHub
After that you can fire a remote event to the client who clicked it and change the GU Ielements from a local script where you receive the remote event.
Sample Code:
Server Script:
game.Workspace.Button.ClickDetector.MouseClick:Connect(function(player) -- Person Who Clicked
game.ReplicatedStorage.ButtonClick:FireClient(player) -- Fire Remote Event for Client
end)
Local Script:
local player = game.Players.LocalPlayer
game.ReplicatedStorage.ButtonClick.OnClientEvent:Connect(function() -- Receive it
player:WaitForChild('MainGui').Frame.Visible = true
end)
Do you want it to change for the player that activated it? or all players?
Just the client, not the whole server.
I edited my post , Please see it.
Checking it out now, thank you.
Ok in StarterGui add a local script and put this code in it
-- Touched event
local Part = workspace["Your Parent Name here"]
Part.Touched:Connect(function(obj)
local h = obj.Parent:FindFirstChild("Humanoid")
if h then
if h.Parent.Name == script.Parent.Parent.Name then
-- Change GUI
end
end
end)
-- Clicked Event
local Part = workspace["Your Parent Name here"]
Part.ClickDetector.MouseClick:Connect(function(plr)
if plr == script.Parent.Parent.Name then
-- Change GUI
end
end)
Thank you very much! Appreciated.