🇲🇽Como cria o evento Mexico no studio lite 🇲🇽
Автор: 🎮 BEICON GAMER 🎮
Загружено: 2026-01-02
Просмотров: 62
tem vários canais que fizeram então não sei qual e original
então
so viz o vídeo
id: 77524652105144
script:
-// CONFIGURATION //-----------------------------------
local OWNER = "BT2GAMER1" -- your Roblox username
local ADMINS = { -- other admins
"Admin1",
"Admin2",
}
local MUSIC_ID = 1837258874 -- your music ID
local EVENT_MODEL_NAME = "MexicoEvent" -- model in ReplicatedStorage
local COMMAND_START = "!Mexico"
local COMMAND_STOP = "!MexicoEnd"
--////////////////////////////////////////////////////////
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local MessagingService = game:GetService("MessagingService")
local adminList = {}
for _, name in ipairs(ADMINS) do
adminList[name:lower()] = true
end
local function isAdmin(player)
if player.Name:lower() == OWNER:lower() then
return true
end
return adminList[player.Name:lower()] ~= nil
end
-- Store active event objects globally
local activeEvent = nil
local activeSound = nil
local function activateMexicoEvent()
local model = ReplicatedStorage:FindFirstChild(EVENT_MODEL_NAME)
if not model then
warn("Mexico event model not found in ReplicatedStorage!")
return
end
-- Clone Mexico event into Workspace
local clone = model:Clone()
clone.Parent = Workspace
activeEvent = clone
-- Play music
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://" .. MUSIC_ID
sound.Looped = false
sound.Volume = 5
sound.Parent = Workspace
sound:Play()
activeSound = sound
print("Mexico event ACTIVATED in this server!")
end
local function stopMexicoEvent()
if activeEvent then
activeEvent:Destroy()
activeEvent = nil
end
if activeSound then
activeSound:Stop()
activeSound:Destroy()
activeSound = nil
end
print("Mexico event STOPPED in this server!")
end
-- Listen for chat commands per player
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
local lowerMsg = msg:lower()
if isAdmin(player) then
if lowerMsg == COMMAND_START:lower() then
-- Publish a message to all servers
local success, err = pcall(function()
MessagingService:PublishAsync("GlobalMexicoEvent", "start")
end)
if not success then
warn("Failed to send start message:", err)
end
elseif lowerMsg == COMMAND_STOP:lower() then
local success, err = pcall(function()
MessagingService:PublishAsync("GlobalMexicoEvent", "stop")
end)
if not success then
warn("Failed to send stop message:", err)
end
end
else
if lowerMsg == COMMAND_START:lower() or lowerMsg == COMMAND_STOP:lower() then
player:Kick("You are not authorized to use this command")
end
end
end)
end)
-- MessagingService listener to respond to global events
local function onMessageReceived(message)
local msg = message.Data
if msg == "start" then
activateMexicoEvent()
elseif msg == "stop" then
stopMexicoEvent()
end
end
-- Subscribe to the global channel
local success, err = pcall(function()
MessagingService:SubscribeAsync("GlobalMexicoEvent", onMessageReceived)
end)
if not success then
warn("Failed to subscribe to MessagingService:", err)
end
_____________________________
#games #roblox #script #tutorial #event
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: