So basically I wanted to make the button go inactive for all players in the server and play the tween for the entire server. I tried doing
for i, v in pairs(game.Players:GetPlayers()) do
v.PlayerGUI --and the location of the button
end
but it did not work. This is where I have the script:
I really want to avoid people clicking that button over and over since it would break the game obviously.
I also tried creating a remoteevent and firing the server but I didn’t know how to do that.
local tweenservice = game:GetService("TweenService")
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Active == true then
script.Parent.Active = false
tweenservice:Create(script.Parent.UIStroke,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 10, Transparency = 1}):Play()
tweenservice:Create(script.Parent,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {BackgroundColor3 = Color3.new(1, 1, 1)}):Play()
game.ReplicatedStorage.Power:FireServer(false)
wait(10)
game.ReplicatedStorage.Power:FireServer(true)
end
end)
script.Parent.MouseEnter:Connect(function()
if script.Parent.Active == true then
tweenservice:Create(script.Parent.UIStroke,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 3.5}):Play()
end
end)
script.Parent.MouseLeave:Connect(function()
if script.Parent.Active == true then
tweenservice:Create(script.Parent.UIStroke,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 1}):Play()
end
end)
Whenever you make a screengui or surfacegui theres an option thats automatically set in properties called ResetOnSpawn. If you check that off and then set the button visible property to false you should be good.
its kinda hard to explain but you are tweening the StarterGui which is the gui that is getting copied to a player’s screen when they join the game which doesnt update as they do play the game
do this instead
local tweenservice = game:GetService("TweenService")
game.StarterGui.StartupScreen.Button.MouseButton1Click:Connect(function()
if game.StarterGui.StartupScreen.Button.Active == true then
game.StarterGui.StartupScreen.Button.Active = false
for _, PlayerUI in ipairs(game.Players:GetPlayers()) do
tweenservice:Create(PlayerUI.StartupScreen.Button.UIStroke,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 10, Transparency = 1}):Play()
tweenservice:Create(PlayerUI.StartupScreen.Button,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {BackgroundColor3 = Color3.new(1, 1, 1)}):Play()
end
game.Workspace.Game.Variables.Power.Value = false
wait(10)
game.Workspace.Game.Variables.Power.Value = true
end
end)
you can’t detect button clicks on the server, however I sent this script here in case you might wanna trigger the tweening by any other way
I deleted the one on the server side. I can show you the one on client side though.
local tweenservice = game:GetService("TweenService")
script.Parent.MouseEnter:Connect(function()
if script.Parent.Active == true then
tweenservice:Create(script.Parent.UIStroke,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 3.5}):Play()
end
end)
script.Parent.MouseLeave:Connect(function()
if script.Parent.Active == true then
tweenservice:Create(script.Parent.UIStroke,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0), {Thickness = 1}):Play()
end
end)