How do I make a personal gui?

So I am making a game where there are buttons that spawn around the map and if you step on one, something happens to you. (Size change, speed boost, etc.)

  1. What do you want to achieve?
    I want to have a gui that says what the button you just stepped on did to you.

  2. What is the issue?
    I got it working fine, but the issue is that it updates for every person in the game. So if someone else steps on a button it will show it for everyone else. I also think that there is a better and more efficient way to do this but I don’t know what.

Explorer

  1. What solutions have you tried so far?
    I’ve tried looking on the Developer Forum but there was nothing I could find.

Here is the coding in the local script:

local LastButton = game.ReplicatedStorage.LastButton -- This is a string value in ReplicatedStorage

while true do
	wait(0.01)
	script.Parent.Text = LastButton.Value
end

And here is the coding for the button in workspace:

local LastButton = game.ReplicatedStorage.LastButton

script.Parent.Touched:Connect(function(player)
	local StandardOutcome = math.random(1,15)
	if StandardOutcome == 1 then
		local Character = player.Parent --player will be player's body part that touches
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then --checks if humanoid exists
			local Scale = math.random(1,4)
			print("Size " .. Scale)
		    local HeightScale = Humanoid:FindFirstChild("BodyHeightScale")
		    HeightScale.Value = HeightScale.Value + Scale - 0.5
		    local WidthScale = Humanoid:FindFirstChild("BodyWidthScale")
		    WidthScale.Value = HeightScale.Value + Scale - 0.5
		    local DepthScale = Humanoid:FindFirstChild("BodyDepthScale")
		    DepthScale.Value = HeightScale.Value + Scale - 0.5
		    local HeadScale = Humanoid:FindFirstChild("HeadScale")
		    HeadScale.Value = HeightScale.Value + Scale - 0.5
		    script.Parent.Parent:Destroy()
		    LastButton.Value = "Last Button: Size Change" -- Changes the value in ReplicatedStorage
		end
	end
end)
1 Like

Have you tried using remote events?

2 Likes

No I haven’t. How would I do that?

1 Like

You can click the tutorial I linked.

2 Likes

Okay. I’ll try to figure it out.

1 Like

I’m super confused. I tried to use it and now it won’t even work.

local LastButton = game.ReplicatedStorage.LastButton
local RemoteEvent = game.ReplicatedStorage.RemoteEvent

script.Parent.Touched:Connect(function(player)
	local StandardOutcome = math.random(1,15)
	if StandardOutcome == 1 then
		local Character = player.Parent --player will be player's body part that touches
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then --checks if humanoid exists
			local Scale = math.random(1,4)
			print("Size " .. Scale)
		    local HeightScale = Humanoid:FindFirstChild("BodyHeightScale")
		    HeightScale.Value = HeightScale.Value + Scale - 0.5
		    local WidthScale = Humanoid:FindFirstChild("BodyWidthScale")
		    WidthScale.Value = HeightScale.Value + Scale - 0.5
		    local DepthScale = Humanoid:FindFirstChild("BodyDepthScale")
		    DepthScale.Value = HeightScale.Value + Scale - 0.5
		    local HeadScale = Humanoid:FindFirstChild("HeadScale")
			HeadScale.Value = HeightScale.Value + Scale - 0.5
			RemoteEvent:FireClient(Character.Parent) -- Added this
			script.Parent.Parent:Destroy()
			LastButton.Value = "Last Button: Size Change"
		end
    end
end)
local LastButton = game.ReplicatedStorage.LastButton
local RemoteEvent = game.ReplicatedStorage.RemoteEvent

RemoteEvent.OnClientEvent:Connect(function() -- Added this
	script.Parent.Text = LastButton.Value
end)
1 Like

Change it to something like this

local Player = game.Players:GetPlayerFromCharacter(Character)

RemoteEvent:FireClient(Player) --needs to be the Player instance under the Players service
1 Like

Oh, this worked. Sorry for not understanding, I’ve never made anything with RemoteEvents before. Thank you! :slightly_smiling_face: