A Randomized Spinning System for Movesets
Client Side:
local button = script.Parent
local player = game.Players.LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local UI = script.Parent.Parent.Parent.Parent
local camera = game.Workspace.CurrentCamera
local Hroot = player.Character:WaitForChild("HumanoidRootPart")
local humanoid = player.Character:WaitForChild("Humanoid")
local CharName = button.Parent.CharacterName
local TypeName = button.Parent.TypeFrame
local Tint = button.Parent.VisualTint
local Visuals = workspace.Map.AbilityRoom.Visuals
button.MouseButton1Click:Connect(function()
rp.Events.General.Spin:FireServer()
local Animator = workspace.Map.AbilityRoom.AbilityRig.Humanoid:FindFirstChild("Animator")
for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local Idle = rp.Animations.Emotes.ImWaiting
local Track = Animator:LoadAnimation(Idle)
Track:Play()
local names = {
"Shidou",
"Sae",
"Isagi",
"Don"
}
local i = 0
while i ~= 50 do
CharName.TextLabel.Text = names[math.random(1, #names)]
if CharName.TextLabel.Text == "Shidou" then
TypeName.TextLabel.Text = "Offence"
Tint.Shidou.Enabled = true
Tint.Sae.Enabled = false
Tint.Don.Enabled = false
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(238, 48, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(238, 48, 255)
elseif CharName.TextLabel.Text == "Sae" then
TypeName.TextLabel.Text = "Support"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = true
Tint.Don.Enabled = false
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(255, 28, 126)
TypeName.BackgroundColor3 = Color3.fromRGB(255, 28, 126)
elseif CharName.TextLabel.Text == "Isagi" then
TypeName.TextLabel.Text = "All Rounder"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = false
Tint.Don.Enabled = false
Tint.Isagi.Enabled = true
CharName.BackgroundColor3 = Color3.fromRGB(149, 206, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(149, 206, 255)
elseif CharName.TextLabel.Text == "Don" then
TypeName.TextLabel.Text = "Defence"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = false
Tint.Don.Enabled = true
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(103, 33, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(103, 33, 255)
end
task.wait(0.1)
i += 1
end
end)
rp.Events.General.Spin.OnClientEvent:Connect(function()
wait(6)
Tint.Visible = true
print(player:GetAttribute("Moveset"))
CharName.TextLabel.Text = player:GetAttribute("Moveset")
if player:GetAttribute("Moveset") == "Isagi" then
TypeName.TextLabel.Text = "All Rounder"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = false
Tint.Don.Enabled = false
Tint.Isagi.Enabled = true
CharName.BackgroundColor3 = Color3.fromRGB(149, 206, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(149, 206, 255)
for i,v in pairs(Visuals:GetDescendants()) do
if v:IsA("ParticleEmitter") then
local Vold = v.Lifetime
v.Lifetime = NumberRange.new(0)
task.wait()
v.Lifetime = Vold
v.Enabled = false
elseif v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = false
elseif v:IsA("MeshPart") or v:IsA("Part") then
v.Transparency = 1
end
end
local Animator = Visuals.Parent.AbilityRig.Humanoid.Animator
for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local Idle = rp.Animations.Emotes.PuzzlePiece
local Track = Animator:LoadAnimation(Idle)
Track:Play()
task.wait(0.1)
for i,v in pairs(Visuals.Isagi:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = true
end
end
print("Isagi Equipped")
else if player:GetAttribute("Moveset") == "Shidou" then
TypeName.TextLabel.Text = "Offence"
Tint.Shidou.Enabled = true
Tint.Sae.Enabled = false
Tint.Don.Enabled = false
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(238, 48, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(238, 48, 255)
for i,v in pairs(Visuals:GetDescendants()) do
if v:IsA("ParticleEmitter") then
local Vold = v.Lifetime
v.Lifetime = NumberRange.new(0)
task.wait()
v.Lifetime = Vold
v.Enabled = false
elseif v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = false
elseif v:IsA("MeshPart") or v:IsA("Part") then
v.Transparency = 1
end
end
local Animator = Visuals.Parent.AbilityRig.Humanoid.Animator
for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local Idle = rp.Animations.Emotes.ShidouGlory
local Track = Animator:LoadAnimation(Idle)
Track:Play()
task.wait(0.1)
for i,v in pairs(Visuals.Shidou:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = true
end
end
print("Shidou Equipped")
else if player:GetAttribute("Moveset") == "Sae" then
TypeName.TextLabel.Text = "Support"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = true
Tint.Don.Enabled = false
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(255, 28, 126)
TypeName.BackgroundColor3 = Color3.fromRGB(255, 28, 126)
for i,v in pairs(Visuals:GetDescendants()) do
if v:IsA("ParticleEmitter") then
local Vold = v.Lifetime
v.Lifetime = NumberRange.new(0)
task.wait()
v.Lifetime = Vold
v.Enabled = false
elseif v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = false
elseif v:IsA("MeshPart") or v:IsA("Part") then
v.Transparency = 1
end
end
local Animator = Visuals.Parent.AbilityRig.Humanoid.Animator
for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local Idle = rp.Animations.Emotes.U20Hops
local Track = Animator:LoadAnimation(Idle)
Track:Play()
task.wait(0.1)
for i,v in pairs(Visuals.Sae:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = true
end
end
print("Sae Equipped")
else if player:GetAttribute("Moveset") == "Don" then
TypeName.TextLabel.Text = "Defence"
Tint.Shidou.Enabled = false
Tint.Sae.Enabled = false
Tint.Don.Enabled = true
Tint.Isagi.Enabled = false
CharName.BackgroundColor3 = Color3.fromRGB(103, 33, 255)
TypeName.BackgroundColor3 = Color3.fromRGB(103, 33, 255)
for i,v in pairs(Visuals:GetDescendants()) do
if v:IsA("ParticleEmitter") then
local Vold = v.Lifetime
v.Lifetime = NumberRange.new(0)
task.wait()
v.Lifetime = Vold
v.Enabled = false
elseif v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = false
elseif v:IsA("MeshPart") or v:IsA("Part") then
v.Transparency = 1
end
end
local Animator = Visuals.Parent.AbilityRig.Humanoid.Animator
for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
track:Stop()
end
local Idle = rp.Animations.Emotes.Bow
local Track = Animator:LoadAnimation(Idle)
Track:Play()
task.wait(0.1)
for i,v in pairs(Visuals.Don:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("Beam") or v:IsA("SpotLight") then
v.Enabled = true
elseif v:IsA("MeshPart") or v:IsA("Part") then
if v.Name ~= "SmokePart" then
v.Transparency = 0
end
end
end
print("Don Equipped")
end
end
end
end
end)
Server Side:
local Players = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local ServerStorage = game:GetService("ServerStorage")
local PhysicsService = game:GetService("PhysicsService")
local Teams = game:GetService("Teams")
local ServerScriptService = game:GetService("ServerScriptService")
local CollectionService = game:GetService("CollectionService")
local HttpService = game:GetService("HttpService")
rp.Events.General.Spin.OnServerEvent:Connect(function(player)
local char = player.Character
local Hroot = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
local Moveset = player:GetAttribute("Moveset")
local Names =
{
"Shidou",
"Sae",
"Isagi",
"Don"
}
player:SetAttribute("Moveset", Names[math.random(1, #Names)])
rp.Events.General.Spin:FireClient(player)
end)
local AbilityDummy = workspace.Map.AbilityRoom.AbilityRig
local DummyHumanoid = AbilityDummy:WaitForChild("Humanoid")
game.ReplicatedStorage.Events.General.CopyCharacter.OnServerEvent:Connect(function(player)
local Character = player.Character
if not Character then return end
local Description = Character.Humanoid:GetAppliedDescription()
DummyHumanoid:ApplyDescription(Description)
end)
A Randomized Spinning System for Movesets