Top.Mail.Ru
Ответы
Аватар пользователя
Аватар пользователя
Аватар пользователя
Аватар пользователя
Программирование
+3

ROBLOX STUDIO программирование помогите ю.

Мне надо сделать режим кто первый зайдет тот получит админ,то есть мне надо скрипт чтоб человек первый зайдет и получает админку а когда выходит рамдому выдается админка lua на эту модель где админку выдать надо HD Admin посмотрите там что в HD Admin,ранг админа 3 и надо чтоб выдалось,можно сделать чтоб система писало префикс ; rank имя и ранг-(admin) надо писать сделайте пожалуйста


пример --do not change anyting else


-- << CONFIGURATION >>
local rank = "VIP"
local rankType = "Server" -- "Temp", "Server" or "Perm". For more info, visit: https://devforum.roblox.com/t/HD/266932
local successColor = Color3.fromRGB(0,255,0)
local errorColor = Color3.fromRGB(255,0,0)



-- << SERVICES/VARIABLES >>
local players = game:GetService("Players")
local tweenService = game:GetService("TweenService")
local debris = game:GetService("Debris")
local hdMain = require(game:GetService("ReplicatedStorage"):WaitForChild("HDAdminSetup")):GetMain()
local hd = hdMain:GetModule("API")
local rankId = tonumber(rank) or hd:GetRankId(rank)
local rankName = hd:GetRankName(rankId)



-- << MAIN >>
--Touch Pad
for a,b in pairs(script.Parent:GetChildren()) do
local touchPart = b:FindFirstChild("TouchPart")
if touchPart then
local touchDe = {}
local originalColor = touchPart.Color
local particles = touchPart.Particles
touchPart.Touched:Connect(function(hit)
local character = hit.Parent
local player = players:GetPlayerFromCharacter(character)
if player and not touchDe[player] then
touchDe[player] = true

--Check rank is lower than giver rank
local plrRankId, plrRankName, plrRankType = hd:GetRank(player)
local newColor = errorColor
if plrRankId < rankId then
--Give rank
hd:SetRank(player, rankId, rankType)
newColor = successColor
else
local errorMessage = "Your rank is already higher than '"..rankName.."'!" --set your rank are higher, message here
if plrRankId == rankId then
errorMessage = "You've already been ranked to '"..rankName.."'!" --set alerdy rank, message here
end
hd:Error(player, errorMessage)
end

--Change pad color
touchPart.Color = newColor
--Color3.BlueCircle (70, 135, 255)
--Color3.TouchPart (248, 248, 248)
--Color3.BlackCircle (100, 100, 100)

--Success effect
if newColor == successColor then
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp and particles then
local particlesClone = particles:Clone()
debris:AddItem(particlesClone, 3)
particlesClone.Parent = hrp
for _, effect in pairs(particlesClone:GetChildren()) do
effect:Emit(2)
end
end
end

--Revert pad color
local tween = tweenService:Create(touchPart, TweenInfo.new (2), {Color = originalColor})
tween:Play()
tween.Completed:Wait()

touchDe[player] = false
end
end)
end
end

По дате
По рейтингу
Аватар пользователя
Ученик
3мес

-- << CONFIGURATION >>
local rank = "Admin" -- Ранг для назначения
local rankType = "Server" -- "Temp", "Server" или "Perm"
local successColor = Color3.fromRGB(0, 255, 0)
local errorColor = Color3.fromRGB(255, 0, 0)

-- << SERVICES/VARIABLES >>
local players = game:GetService("Players")
local tweenService = game:GetService("TweenService")
local debris = game:GetService("Debris")
local hdMain = require(game:GetService("ReplicatedStorage"):WaitForChild("HDAdminSetup")):GetMain()
local hd = hdMain:GetModule("API")
local rankId = tonumber(rank) or hd:GetRankId(rank)
local rankName = hd:GetRankName(rankId)

local currentAdmin = nil

local function assignAdmin(player)
local plrRankId = hd:GetRank(player)
if plrRankId < rankId then
hd:SetRank(player, rankId, rankType)
player.DisplayName = "[Admin] " .. player.Name
else
hd:Error(player, "Ваш ранг уже выше, чем '" .. rankName .. "'!")
end
end

players.PlayerAdded:Connect(function(player)
if not currentAdmin then
currentAdmin = player
assignAdmin(player)
end
end)

players.PlayerRemoving:Connect(function(player)
if player == currentAdmin then
local remainingPlayers = {}
for _, plr in ipairs(players:GetPlayers()) do
if plr ~= player then
table.insert(remainingPlayers, plr)
end
end
if #remainingPlayers > 0 then
local newAdmin = remainingPlayers[math.random(1, #remainingPlayers)]
currentAdmin = newAdmin
assignAdmin(newAdmin)
end
end
end)

for a,b in pairs(script.Parent:GetChildren()) do
local touchPart = b:FindFirstChild("TouchPart")
if touchPart then
local touchDe = {}
local originalColor = touchPart.Color
local particles = touchPart.Particles
touchPart.Touched:Connect(function(hit)
local character = hit.Parent
local player = players:GetPlayerFromCharacter(character)
if player and not touchDe[player] then
touchDe[player] = true
local plrRankId = hd:GetRank(player)
local newColor = errorColor
if plrRankId < rankId then
hd:SetRank(player, rankId, rankType)
newColor = successColor
else
hd:Error(player, "You already have a higher rank than '"..rankName.."'!")
end
touchPart.Color = newColor

if newColor == successColor then
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp and particles then
local particlesClone = particles:Clone()
debris:AddItem(particlesClone, 3)
particlesClone.Parent = hrp
for _, effect in pairs(particlesClone:GetChildren()) do
effect:Emit(2)
end
end
end
local tween = tweenService:Create(touchPart, TweenInfo.new(2), {Color = originalColor})
tween:Play()
tween.Completed:Wait()
touchDe[player] = false
end
end)
end
end


Вот пример

Аватар пользователя
Мастер
3мес

Слишком много букав