When I move with a shield I made, it sort of flicks me around.
Video:
Local Script:
wait(2)
-- // SERVICES // --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
-- // VARIABLES // --
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Event = ReplicatedStorage.AbilityEvents:WaitForChild("GuardShield")
local Hum = Character:WaitForChild("Humanoid")
-- // CHECK // --
repeat
wait()
until
Character.Parent == workspace
-- // SCRIPT VARIABLES // --
local Holding = false
local Debounce = false
-- // SCRIPT // --
UIS.InputBegan:Connect(function(Input, gameProcessed)
if not gameProcessed and Debounce == false and Hum.ragdoll.Value == false and not Hum.PlatformStand and Hum.Health > 0 then
if Input.KeyCode == Enum.KeyCode.H and not Holding and not Debounce then
Event:FireServer("Begin", Player)
Debounce = true
Holding = true
while Holding do
wait()
end
print(Holding)
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.H and Holding and Debounce then
Holding = false
Event:FireServer("Finish", Player)
wait(5)
Debounce = false
end
end)
-- // EXTRA // --
ReplicatedStorage.ShieldCollisionOff.OnClientEvent:Connect(function()
local shield = Player.Character:WaitForChild("GuardShield")
shield.CanCollide = false
end)
Server Script:
-- // SERVICES // --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
-- // VARIABLES // --
local Event = ReplicatedStorage.AbilityEvents:WaitForChild("GuardShield")
local Shield = game.Workspace:FindFirstChild("GuardShield")
-- // SCRIPT // --
Event.OnServerEvent:Connect(function(Player, Type)
local Character = Player.Character
if Type == "Begin" then
local S = Shield:Clone()
S.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-4)
local weld = Instance.new("WeldConstraint")
weld.Part0 = S
weld.Part1 = Character.HumanoidRootPart
weld.Parent = S
game.ReplicatedStorage.ShieldCollisionOff:FireClient(Player)
S.Orientation = Shield.Orientation
S.Parent = Character
S.Anchored = false
Character.Humanoid.WalkSpeed = 14
elseif Type == "Finish" then
Character:FindFirstChild("GuardShield").Attachment.ParticleEmitter.Enabled = false
Character:FindFirstChild("GuardShield"):Destroy()
Character.Humanoid.WalkSpeed = 16
end)
end
end)