I have a script that when you touch certain bricks a number on a GUI on the screen changes +1. So if the player touches the 5 bricks, then the GUI/TextLabel changes to 5. The problem is that it changes for all the players in-game and I do not know how to fix this, been trying all day.
I am using NumberValue to change the value on the GUI. The NumberValue is in StarterGui in the GUI and is named "ProcentValue".
This is the brick you touch.
local Dbounce = true
script.Parent.Touched:Connect(function(hit)
if Dbounce == true then
Dbounce = false
game.StarterGui.ProcMeter.ProcentValue.Value = game.StarterGui.ProcMeter.ProcentValue.Value +1
wait(15)
Dbounce = true
end
end)
This is the script that does so the number can change in the GUI on the screen.
while wait()do
PV = game.StarterGui.ProcMeter.ProcentValue.Value
PV2 = ""..game.StarterGui.ProcMeter.ProcentValue.Value
if PV == 0 then
script.Parent.Text = PV2
elseif PV == 1 then
script.Parent.Text = PV2
elseif PV == 2 then
script.Parent.Text = PV2
elseif PV == 3 then
script.Parent.Text = PV2
elseif PV == 4 then
script.Parent.Text = PV2
elseif PV == 5 then
script.Parent.Text = PV2
elseif PV == 6 then
script.Parent.Text = PV2
elseif PV == 7 then
script.Parent.Text = PV2
elseif PV == 8 then
script.Parent.Text = PV2
elseif PV == 9 then
script.Parent.Text = PV2
elseif PV == 10 then
script.Parent.Text = PV2
end
end
Does anyone know why this show for all the players and not only the local player? If you need more information just ask, thanks for the help, Xsodar

4 comments
You should only Increment PlayerGui, not StarterGui
Just like roblor said, increment a PlayerGui so that only the player can see it, not the whole server.
How do I do this if the script is not a localscript?
The first script is a normal script and the second one is a localscript.