local character = player.Character or player.CharacterAdded:Wait()
game.ReplicatedStorage.Uniforms.Formals.OnServerEvent:Connect(function(plr)
local plrCharcter = plr.Character or plr.CharacterAdded:Wait()
if FloodCheck:Check(plr, accessremote, 0.08333) then
local FloodCheck = require(game.ServerScriptService.RemoteFloodCheck)
local function accessoryspawn(plr,g)
local char = plr.Character or plr.CharacterAdded:Wait()
g.Parent = char.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" or C[i].className == "WedgePart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
g.Middle.Transparency = 1
end
local Y = Instance.new("Weld")
Y.Part0 = char.Head
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
local Formals = {
[5] = {hat = game.ServerStorage.USMPatrol.E2};
[10] = {hat = game.ServerStorage.USMPatrol.E2};
[15] = {hat = game.ServerStorage.USMPatrol.E2};
[20] = {hat = game.ServerStorage.USMPatrol.E2};
[25] = {hat = game.ServerStorage.USMPatrol.E2};
[30] = {hat = game.ServerStorage.USMPatrol.E2};
[35] = {hat = game.ServerStorage.USMPatrol.E2};
[37] = {hat = game.ServerStorage.USMPatrol.E2};
[40] = {hat = game.ServerStorage.USMPatrol.E2};
[42] = {hat = game.ServerStorage.USMPatrol.E2};
[45] = {hat = game.ServerStorage.USMPatrol.E2};
[50] = {hat = game.ServerStorage.USMPatrol.E2};
[55] = {hat = game.ServerStorage.USMPatrol.E2};
[60] = {hat = game.ServerStorage.USMPatrol.E2};
[61] = {hat = game.ServerStorage.USMPatrol.E2};
[62] = {hat = game.ServerStorage.USMPatrol.E2};
[63] = {hat = game.ServerStorage.USMPatrol.E2};
[66] = {hat = game.ServerStorage.USMPatrol.E2};
[67] = {hat = game.ServerStorage.USMPatrol.E2};
[68] = {hat = game.ServerStorage.USMPatrol.E2};
[70] = {hat = game.ServerStorage.USMPatrol.E2};
[235] = {hat = game.ServerStorage.USMPatrol.O10};
[255] = {hat = game.ServerStorage.USMPatrol.E2};
};
local accessremote = game.ReplicatedStorage.Accessories.access
game.ReplicatedStorage.Accessories.access.OnServerEvent:Connect(function(plr, Outfit, shirthat)
if FloodCheck:Check(plr, accessremote, 0.08333) then
if shirthat == "hat" and Outfit == "USMPatrol" then
local formalrank = plr:GetRankInGroup(4219097)
local info = Formals[formalrank]
print (info)
if info then
local g = info.hat
accessoryspawn(plr,g)
end
end
end
end)
This is what I ended up doing for the script; I made it into a function so I don’t have to copy & paste the entire clone & weld lines of code for each remote event fired, conserving lines of code - and making it easier to edit in the future.