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!
So I’ve made a gui for a radio and I want it only to appear whenever the player is on a specific team, so I created a local script in starter player scripts which clone the radio guilocated inside the script to the player gui but whenever I do that, half the systems and scripts in the gui are now broken and some remove event don’t fire anymore.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried everything I could think off by modifying the scripts
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
So whenever I press the panic button, in the console, the first things print but then when I got to the script which is supposed to received the signal of the remote even being fired, it doesn’t work
the RemoteEvent should be inside of ReplicatedStorage
and the script should be in ServerScriptService (not with the event)
-- LocalScript inside the button
local RS = game:GetService("ReplicatedStorage")
local PanicEvent = RS.Panic_Remote -- The remote should be in ReplicatedStorage
local Player = game.Players.LocalPlayer
Cooldown = false
script.Parent.MouseButton1Click:Connect(function()
if Cooldown then return end -- Ignore the click if cooldown is active
print("NOOO")
PanicEvent:FireServer() -- You don't need to pass player when doing :FireServer()
print("LOL")
Cooldown = true
task.wait(30)
Cooldown = false
end)
-- ServerScript in ServerScriptService
local RS = game:GetService("ReplicatedStorage")
local PanicEvent = RS.Panic_Remote
-- Use OnServerEvent on the server
--[[
Client -> Server (OnServerEvent)
Server -> Client (OnClientEvent)
]]
-- Player will always be the first argument when doing OnServerEvent
-- Player = Player who did :FireServer()
PanicEvent.OnServerEvent:Connect(function(Player: Player)
print("WHATTT")
RS:FireAllClients() -- Don't need to pass player when firing all players
end)
But all the items in the script are located on a gui, the only thing that move is when I clone the GUI into the player gui, does that still change something?
I’ve followed your instructions and now it works! But now I encounter another problem, when I got on test with 2 players, only the player 1 receives the panic notifications on his radio and not the player 2, no matter who pressed the panic button.
I think I had the basic for the script but yours looks much simpler. I will scrap my current scripts and try to rearrange them clearer to see if it works after that, thank you.