When i press my UI it doesn't do anything

Hello, I’m a noobie/rookie developer on roblox and this is my first time posting stuff there.

So, I’m trying to make something, that when the player press a button a value get checked, and it’s not working. So here is the code.

local RainM = {}

local ReplicatedStorage = game.ReplicatedStorage

local ServerStorage = game.ServerStorage

local ScreenGUI = game.StarterGui

--// Change The class name of Script

local function CreateRaining()

local Raining_Boolean = Instance.new("BoolValue")

Raining_Boolean.Name = "Raining"

Raining_Boolean.Parent = ServerStorage

Raining_Boolean.Value = false

end

local function RainingEnabled()

local Raining = ServerStorage:FindFirstChild("Raining")

Raining.Value = true

end

local function RainingDisabled()

local Raining = ServerStorage:FindFirstChild("Raining")

Raining.Value = false

end

--// Enable Rain

ScreenGUI.Game_UI.Testing.Raining_UI.Frame.Enable.MouseButton1Up:Connect(RainingEnabled,ReplicatedStorage.MainGame.Events.SIUUU:FireServer())

ScreenGUI.Game_UI.Testing.Raining_UI.Frame.Disable.MouseButton1Up:Connect(RainingDisabled,ReplicatedStorage.MainGame.Events.SIUUU:FireServer())

print("Working")

return RainM, CreateRaining()```

Hi!

UI interaction events can only be received by the client, so you would have to use a LocalScript to receive it.

1 Like

Oh Thanks! So much apreciated!

You are using StarterGui as the player’s UI. This won’t work. Instead, use each player’s PlayerGui. This is what the player sees, not what’s in StarterGui.