I encountered a problem that when I call the opening gui through the Bindable Event module, for some reason it opens on the server and even on the server there are no changes
Here the problem is not even in the bindable event, but in the gui
Also below are scripts and videos with the problem
Video: https://youtu.be/OX0NAt8VlKs
Scripts:
ShowTextAndOpenGui
local ButtonHoverModule = require(game:GetService("ReplicatedStorage").GuiModules.ButtonHoverModule)
local buttons = script.Parent.Parent.Buttons:GetChildren()
for _, button in pairs(buttons) do
ButtonHoverModule.applyHoverEffect(button)
end
ButtonHoverModule – in this module fire bindable event
local ButtonHoverModule = {}
function ButtonHoverModule.applyHoverEffect(button)
local TW, Info = game:GetService("TweenService"), TweenInfo.new(0.4, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
local Up, Up2, ClickStyle, Down, Down2 = {TextTransparency = 0.1}, {Thickness = 4, Color = Color3.new(1, 0.627451, 0.109804)}, {Thickness = 5, Color = Color3.new(1, 0.835294, 0)}, {TextTransparency = 1}, {Thickness = 1.5, Color = Color3.new(0.290196, 0.290196, 0.290196)}
local textLabel, uiStroke, isMouseOver = button.TextLabel, button.UIStroke, false
local OpenEvent = game:GetService("ReplicatedStorage").GuiEvent.OpenEvent.BindableEvent.OpenEvent
local function applyTween(object, properties)
TW:Create(object, Info, properties):Play()
end
local function hover()
isMouseOver = true
textLabel.Active = true
applyTween(textLabel, Up)
applyTween(uiStroke, Up2)
end
local function leave()
isMouseOver = false
applyTween(textLabel, Down)
applyTween(uiStroke, Down2)
textLabel.Active = false
end
local function onClick()
if isMouseOver then
applyTween(uiStroke, ClickStyle)
wait(0.3)
if isMouseOver then
applyTween(uiStroke, Up2)
end
end
end
local function SendOpenEvent()
OpenEvent:Fire(button)
end
button.MouseButton1Click:Connect(function()
onClick()
SendOpenEvent()
end)
button.MouseEnter:Connect(hover)
button.MouseLeave:Connect(leave)
end
return ButtonHoverModule
OpenGui
local OpenEvent, ButtonOpenModule = game:GetService("ReplicatedStorage").GuiEvent.OpenEvent.BindableEvent.OpenEvent, require(game:GetService("ReplicatedStorage").GuiModules.GuiOpenModule)
local function Open2(data)
ButtonOpenModule.ApplyOpenGui(data)
end
OpenEvent.Event:Connect(function(GuiName)
Open2(GuiName)
end)
GuiOpenModule – there may be an error in this script
local GuiOpenModule = {}
function GuiOpenModule.ApplyOpenGui(data)
local TW, Info = game:GetService("TweenService"), TweenInfo.new(0.7, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
local ScrollUi = game.StarterGui.InGameGui.UI.Scroll.ScrollingBackground
local opened = false
local OpenEvent = game:GetService("ReplicatedStorage").GuiEvent.OpenEvent.BindableEvent.OpenEvent
local function applyTween(object, properties)
TW:Create(object, Info, properties):Play()
end
local ScrollGuiParamsOpen = {
BackgroundTransparency = 0.9,
ScrollBarImageTransparency = 0.38
}
local UIStrokeOpen = {
Thickness = 1.9
}
local ScrollGuiParamsClose = {
BackgroundTransparency = 1,
ScrollBarImageTransparency = 1
}
local UIStrokeClose = {
Thickness = 0
}
local function Open(data) -- problem gui
if opened == false then
opened = true
print(data)
ScrollUi.Visible = true
wait(0.1)
applyTween(ScrollUi, ScrollGuiParamsOpen)
applyTween(ScrollUi.UIStroke, UIStrokeOpen)
else
opened = false
print(data)
applyTween(ScrollUi, ScrollGuiParamsClose)
applyTween(ScrollUi.UIStroke, UIStrokeClose)
wait(0.2)
ScrollUi.Visible = false
end
end
Open(data)
end
return GuiOpenModule