MultitaskAlert
Introduction
Hello everyone! I’m @FxllenCode, and today I am releasing my first little system, MultitaskAlert. I’m going to start with a simple poll:
How important is multitasking in the development process?
- Multitasking is an important part of the development process.
- Multitasking is not an important part of the development process.
0 voters
Likely, most people believe it is important. This is what had lead me to create this system.
If you have a small game, you likely want to greet people who join. This has been proven to make them stay in the game longer, thus potentially moving them from a player to a paying player. As a developer, I often do not have the time to sit around in the game and wait for people to join. I usually will open up studio, and start working. Even with 2 monitors, I usually have studio open on one, and documentaion or other sites open on the other. I forget that people join, and they end up leaving as I am AFK.
Introducing MultitaskAlert!
MultitaskAlert is a simple system consisting of three things: A Script, a LocalScript, and a RemoteEvent. Don’t fret, I’ll get into setup later! MultitaskAlert is a system that will alert you when a player enters your game. How, you may ask? The system will play an alert noise in game when someone joins. This noise is Client-Sided, and only the whitelisted user will hear it (I’ll get into that later). On top of that, you must say a command in the chat to turn on the system, that way you aren’t bombarded by noise when you aren’t AFK. Currently, only 1 user can be whitelisted, however I am working on V2, which will be much simpler, and have more functionality.
How does it work?
As stated above, it consists of a Script, a LocalScript, and a RemoteEvent. The script checks to make sure the user is whitelisted, and it also checks that the user has said the command. Once it confirms both of these, it waits until someone joins. When they join, it fires the remote event, which plays the sound on the whitelisted users’ game. As of now, the script isn’t as clean or as efficient as it could be, V1 has mainly been for functionality, now that it’s functional, I’ll be starting a complete rewrite of this.
Where can I get it?
Grab the model here:
How to set it up?
Grab the model and put it into your roblox game. Then, open up the README, and read it! It will give you in depth instructions. It’s quite simple.
FAQ
Q: Why should I use this?
A: It’s good to use if you want to greet new players who join your game, but don’t have the time to sit around and do nothing.
Q: Can I change the commands?
A: Yes! The command can be changed. Make sure to read the README.
Q: I have a bug, how can I report it?
A: Let me know in the comments below.
More information
Topic Edit Log
Last edit: 2020-10-11T22:19:00Z
Support the developer
Thank you for your interest in supporting me! Here is a game, new one coming soon:
Code
Before I show the code, yes, I know it could be better. Like I said, v1 is going for functionality. I know there are much better methods. I am interested to hear your thoughts however, I will keep these in mind during v2.
MultiServer
-- Editable Features:
local username = "FxllenCode" -- Username of whitelisted user goes here, used for remote event.
local allowed = 82738847 -- UserID of whitelisted user goes here.
local commandStart = "!startAlerts" -- You can change this to whatever you want.
local commandEnd = "!endAlerts" -- This one too.
local sound = "1403257129" -- Set this to any audio ID you would like.
-- Do not touch the lines below unless you know what your are doing.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local remoteEvent = ReplicatedStorage:WaitForChild("PlaySound")
local check = false
local enabled = false
local confirm = false
local cache = {}
function getUserIdFromUsername(name)
-- First, check if the cache contains the name
if cache[name] then return cache[name] end
-- Second, check if the user is already connected to the server
local player = Players:FindFirstChild(name)
if player then
cache[name] = player.UserId
return player.UserId
end
-- If all else fails, send a request
local id
pcall(function ()
id = Players:GetUserIdFromNameAsync(name)
end)
cache[name] = id
return id
end
function checkForPerms(name)
local id = getUserIdFromUsername(name)
if id == allowed then
check = true
print("Sound Perms")
print(id)
else
check = false
print("No perms")
print(id)
end
end
function pausePerms(player)
if enabled == true then
confirm = false
enabled = false
end
end
function confirmPerms(player)
if check == true then
confirm = true
while confirm == true do
enabled = true
wait(5)
end
end
end
Players.PlayerAdded:Connect(function(player)
checkForPerms(player.Name)
end)
game.Players.PlayerAdded:Connect(function(player) -- call the yes
player.Chatted:Connect(function(message)
if message == commandStart then
confirmPerms(player)
end
end)
end)
game.Players.PlayerAdded:Connect(function(player) -- stop calling the yes
player.Chatted:Connect(function(message)
if message == commandEnd then
pausePerms(player)
end
end)
end)
game.Players.PlayerAdded:Connect(function()
if enabled then
print("e")
remoteEvent:FireClient(game:GetService("Players"):FindFirstChild(username), sound)
end
end)
print(check)
print(allowed)
print()
MultiClient
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("PlaySound")
local alert = Instance.new("Sound", game.Workspace)
local function playAlertSound(sound)
alert.SoundId = "rbxassetid://" .. sound
alert:Play()
end
remoteEvent.OnClientEvent:Connect(playAlertSound)
Conclusion
If you have any questions or concerns, feel free to let me know below! If you use it, I would be honored to see which game it is in! I always like to see the place my product is being used. Finally, thank you for the support. I know usually I’m the guy who makes giant terrain showcases, but today, I’m playing scripter!
Thank you so much!