Sure.
-- \\ Player-Related Variables // --
local Players = game:GetService("Players");
local Player = Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
-- \\ Services // --
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
-- \\ Modules // --
local AnimationModule = require(ReplicatedStorage.Modules.GeneralModules.AnimModule)
-- \\ Misc. Variable // --
local Debounce = false
local Count = 0
local ButtonDown = false
local Anim : Animation = {
AnimationModule.getSingleAnimation(Character:WaitForChild("Humanoid"), script.BlockStances.BaseStance),
AnimationModule.getSingleAnimation(Character:WaitForChild("Humanoid"), script.BlockStances.UpperStance),
AnimationModule.getSingleAnimation(Character:WaitForChild("Humanoid"), script.BlockStances.LowerStance)
}
-- \\ Functions // --
local CountChanger = function()
print(Count)
if Count <= 3 then
Count += 1
elseif Count == 4 then
Count = 1
end
end
local AnimationChanger = function()
if Count == 1 then
print("Why no work")
Anim[1].Looped = true
Anim[1]:Play()
elseif Count == 2 then
Anim[2].Looped = true
Anim[2]:Play()
elseif Count == 3 then
Anim[3].Looped = true
Anim[3]:Play()
end
end
local AnimationStopper = function()
if Count == 1 then
Anim[1].Looped = false
Anim[1]:Stop()
elseif Count == 2 then
Anim[2].Looped = true
Anim[2]:Stop()
elseif Count == 3 then
Anim[3].Looped = true
Anim[3]:Stop()
end
end
UserInputService.InputBegan:Connect(function(Input, GPE)
if GPE == true then return end
if Character:WaitForChild("StatusFolder"):FindFirstChild("Stunned") then
print('loser')
return
end
if Character:FindFirstChildOfClass("Tool") then
print('toolienotallowed')
return
end
if Input.KeyCode == Enum.KeyCode.F then
if Debounce == false then
Debounce = true
ButtonDown = true
CountChanger()
print("goo")
AnimationChanger()
ReplicatedStorage.RemoteEvents.CombatEvents.Blocking:FireServer(Count)
end
end
end)
UserInputService.InputEnded:Connect(function(Input, GPE)
if GPE == true then return end
if Character:WaitForChild("StatusFolder"):FindFirstChild("Stunned") then
print('loser')
return
end
if Character:FindFirstChildOfClass("Tool") then
print('toolienotallowed')
return
end
if Input.KeyCode == Enum.KeyCode.F and ButtonDown == true then
ReplicatedStorage.RemoteEvents.CombatEvents.Release:FireServer()
Character:SetAttribute("IsBlocking", false)
ButtonDown = false
print("uh?")
AnimationStopper()
wait(.9)
Debounce = false
end
end)
This is the current local script, which is handling the animations, but I want it to change the actual stances, located here (In the server.)
StanceSwitch.OnServerEvent:Connect(function(Player, Count, Blocking)
if Blocking ~= true then
Stances = Count
print(Stances)
StanceSwitching.Switches(Player, Count)
end
if Blocking == true then
BStances = Count
print(BStances)
StanceSwitching.BlockSwitches(Player, Count)
end
end)
–Block Switches
function StanceSwitch.BlockSwitches(Player, Count)
if Count == 1 then
Player:SetAttribute("BStance", BlockStances[1])
elseif Count == 2 then
Player:SetAttribute("BStance", BlockStances[2])
elseif Count == 3 then
Player:SetAttribute("BStance", BlockStances[3])
end
end
And the local script is for the animation
This is in the server currently, and what would happen if I linked it up to this
UserInputService.InputBegan:Connect(function(Input, GPE)
if GPE then return end
if Debounce == true then return end
if Input.KeyCode == Enum.KeyCode.T and UserInputService:IsKeyDown(Enum.KeyCode.F) then
if Debounce == false then
if BlockingBoppin.Parent == Players.LocalPlayer.Character.Head then
Debounce = true
BlockingBoppin.Star:Emit(1)
BlockingBoppin.Circle:Emit(1)
BlockingBoppin.StarAfterImage:Emit(1)
BlockingBoppin.CircleAfterImage:Emit(1)
BlockCountChanger()
Stances:FireServer(BCount, true)
task.wait(5)
Debounce = false
elseif BlockingBoppin.Parent ~= Players.LocalPlayer.Character.Head then
Debounce = true
BlockingBoppin.Parent = Players.LocalPlayer.Character.Head
BlockingBoppin.Star:Emit(1)
BlockingBoppin.Circle:Emit(1)
BlockingBoppin.StarAfterImage:Emit(1)
BlockingBoppin.CircleAfterImage:Emit(1)
BlockCountChanger()
Stances:FireServer(BCount, true)
task.wait(5)
Debounce = false
end
end
end
end)
sorry if it’s packed on your screen, but to fully understand I believe you need these 4 sections of the scripts.