well my problem is that the following localscript, it should detect the FireServer of another local script, but it doesn’t. It does not give error in the output nor does it give the print, so I do not know if it is OnClientEvent or OnServer event, I already tried both but it does not work
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ScreenBarBgGraphicsFire = ReplicatedStorage:WaitForChild("ScreenBarBgGraphicsFire")
local loadingScreen = script.Pantallacarga
loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui
local function FireBarBg(Position, Text)
loadingScreen.Background.BarBG.Bar:TweenSize(UDim2.new(Position), nil, nil, 0)
loadingScreen.Background.Counter.Text = Text
print("siu")
end
ScreenBarBgGraphicsFire.OnServerEvent:Connect(FireBarBg)
is this script in a client script? If so change OnServerEvent to OnClientEvent, and when doing OnServerEvent you would always have to put: OnServerEvent:Connect(player --Always put this, --Your value here)
Use OnClientEvent/FireServer(), using OnClientEvent doesn’t require the Player parameter and will receive the requests when FireClient() is called on the server, while OnClientEvent() is waiting to receive that said “request” (Client-wise)
If you’re handling this on the server:
Use OnServerEvent/FireClient(), using OnServerEvent will receive the requests when FireServer() is called on the client, which gives the Player Instance the first parameter, while FireClient() requires that said “Player Instance”
(translate this)
no se bien lo que querias hacer pero el primer error es que un localScript no puede detectar el FireServer de otro localScript sin un intermediario
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ScreenBarBgGraphicsFire = ReplicatedStorage:WaitForChild("ScreenBarBgGraphicsFire")
local loadingScreen = script.Pantallacarga
loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui
local function FireBarBg(plr, Position, Text) --changed
if tostring(plr.Name) == tostring(game.Players.LocalPlayer.Name) then
loadingScreen.Background.BarBG.Bar:TweenSize(UDim2.new(Position), nil, nil, 0)
loadingScreen.Background.Counter.Text = Text
print("siu")
end
end
ScreenBarBgGraphicsFire.OnClientEvent:Connect(FireBarBg) --changed
tendras que añadir un script (no local y en ServerScriptService) y poner el siguente codigo
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ScreenBarBgGraphicsFire = ReplicatedStorage:WaitForChild("ScreenBarBgGraphicsFire")
ScreenBarBgGraphicsFire.OnServerEvent:Connect(function(goFor,arg1,arg2) --plr, Position, text
ScreenBarBgGraphicsFire:FireAllClients(goFor,arg1,arg2)
end)