You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Upon clicking on a button, the button’s text will change and every player’s button text will change as well. -
What is the issue? Include screenshots / videos if possible!
Wouldn’t change for every player, only the client. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have, and tried to see if I could use RemoteEvents it wouldn’t work though
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
LocalScript:
local button = script.Parent.Parent.PauseButton
local pausebool = game.ReplicatedStorage:WaitForChild("Paused")
local Event = game.ReplicatedStorage:WaitForChild("PauseEvent")
-- functions
function pause(a,b,c,d)
for _,player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
character.Humanoid.WalkSpeed = a
character.Humanoid.JumpHeight = b
pausebool = c
button.Text = d
end
end
-- button scripts
button.MouseButton1Click:Connect(function()
if pausebool == false then
pause(0,0,true,"Unpause")
else
pause(16,7.2,false,"Pause")
end
end)
ServerScript:
local PauseEvent = game.ReplicatedStorage:WaitForChild("PauseEvent")
local PlayersService = game:GetService("Players")
local player = PlayersService.LocalPlayer
local pausebool = game.ReplicatedStorage:WaitForChild("Paused")
PauseEvent:FireAllClients(function()
if pausebool == false then
for _,player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
character.Humanoid.WalkSpeed = 0
character.Humanoid.JumpHeight = 0
pausebool = true
player.PlayerAdded:Connect(function(Player)
Player:WaitForChild('PlayerGui'):WaitForChild('MainUI').PauseButton.Text = "Unpaused"
end)
end
else
for _,player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
character.Humanoid.WalkSpeed = 16
character.Humanoid.JumpHeight = 7.2
pausebool = false
player.PlayerAdded:Connect(function(Player)
Player:WaitForChild('PlayerGui'):WaitForChild('MainUI').PauseButton.Text = "Pause"
end)
end
end
end)
I also don’t know a lot about scripting yet, I am still learning.