Now that we went through all you need to learn, Lets create our first command as example.
Client Side
local players = game:GetService("Players")
local replicated_storage = game:GetService("ReplicatedStorage")
local client = players.LocalPlayer
local storage = replicated_storage:WaitForChild("EXE6_STORAGE")
local events = storage.events
local CustomCommands = require(storage.modules.CustomCommands)
local TimeCC = CustomCommands:RegisterCommand("Time")
TimeCC.Description = "Change in-game time."
TimeCC.Icon = "rbxassetid://11963371162"
TimeCC.Event = storage.utilities.custom_commands.ChangeTime
TimeCC:AddParameter("Boolean", {
Name = "Animate"
})
TimeCC:AddParameter("Slider", {
Name = "Time",
SliderRange = NumberRange.new(1, 24),
SliderDefault = game.Lighting.ClockTime,
SliderIncrement = .01,
})
Server Side
local tween_service = game:GetService("TweenService")
local replicated_storage = game:GetService("ReplicatedStorage")
local smooth = TweenInfo.new(10, Enum.EasingStyle.Exponential)
local storage = replicated_storage:WaitForChild("EXE6_STORAGE")
storage.utilities.custom_commands.ChangeTime.OnServerEvent:Connect(function(moderator, data)
if data.Animate then
tween_service:Create(game.Lighting, smooth, {ClockTime = data["Time"]}):Play()
else
game.Lighting.ClockTime = data["Time"]
end
end)
Congrats! You have now officially learned everything about Custom Commands.