#Bug in my script and I cant find it.
9 messages · Page 1 of 1 (latest)
Can you send a code here?
do i jsut copy and paste the script ?
im not getting any errors so
local Character = script.Parent;
local Humanoid = Character:WaitForChild("Humanoid");
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart");
local SideGyro = Instance.new("BodyGyro")
SideGyro.MaxTorque = Vector3.new(3e5,0,3e5)
SideGyro.P = 5e5
SideGyro.Parent = HumanoidRootPart
local RunService = game:GetService('RunService')
local UserInputService = game:GetService('UserInputService')
local Dashing = false
local DashSpeed = 45
local DoubleTaps = {}
local Animations = {
["DashLeft"] = 'rbxassetid://18327359739';
["DashRight"] = 'rbxassetid://18327357819';
["DashFront"] = 'rbxassetid://18327355849';
["DashBack"] = 'rbxassetid://18327352158';
}
for i,v in pairs(Animations) do
local Anim = Instance.new("Animation")
Anim.AnimationId = v
Anim = Humanoid:LoadAnimation(Anim)
Animations[i] = Anim
end
function Dash(Key)
if Dashing then
return
end
local DashAnim = "Back"
local Front = -1
local Side = 0
if Key == Enum.KeyCode.A then
Side=-1
Front = 0
DashAnim = "Left"
end
if Key == Enum.KeyCode.D then
Side=1
Front = 0
DashAnim = "Right"
end
if Key == Enum.KeyCode.W then
Side=0
Front = 1
DashAnim = "Front"
end
if Key == Enum.KeyCode.S then
Side=0
Front = -1
DashAnim = "Back"
end
Part 1
Dashing = true
Animations["Dash"..DashAnim]:Play()
local DashVelocity = Instance.new("BodyVelocity")
DashVelocity.MaxForce = Vector3.new(math.huge,0,math.huge)
DashVelocity.P = 9e9
DashVelocity.Parent = HumanoidRootPart
DashVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * (Front * DashSpeed) + HumanoidRootPart.CFrame.RightVector * (Side * DashSpeed)
coroutine.wrap(function()
task.wait(.1)
local DashEffect = game.ReplicatedStorage.DustTrail:Clone();
DashEffect.Parent = workspace;
if DashAnim == "Left" then
DashEffect.DustRight:Destroy();
DashEffect.CFrame = Character["Right Leg"].CFrame * CFrame.new(-1,0,-2);
else if DashAnim == "Right" then
DashEffect.DustLeft:Destroy();
DashEffect.CFrame = Character["Left Leg"].CFrame * CFrame.new(3,2,5);
else if DashAnim == "Front" then
DashEffect.DustLeft:Destroy();
DashEffect.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,-1,3);
else
DashEffect.DustLeft:Destroy();
DashEffect.CFrame = Character.HumanoidRootPart.CFrame *
CFrame.new(0,-1,-.5);
end
end
end
for i,v in pairs(DashEffect:GetDescendants()) do
if not v:IsA("ParticleEmitter") then continue end
v:Emit(5);
end
game.Debris:AddItem(DashEffect, .5);
end)()
repeat wait() DashVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * (Front * DashSpeed) + HumanoidRootPart.CFrame.RightVector * (Side * DashSpeed)
until not Animations["Dash"..DashAnim].IsPlaying
Dashing = false
DashVelocity:Destroy()
end
function LoadDoubleTap(Key,Funct)
DoubleTaps[Key] = tick()-10
UserInputService.InputBegan:Connect(function(Pressed,Typing)
if Pressed.KeyCode == Key then
if (tick() - DoubleTaps[Key]) < .23 then
Funct(Key)
else
DoubleTaps[Key] = tick()
end
end
end)
end
LoadDoubleTap(Enum.KeyCode.W,Dash)
LoadDoubleTap(Enum.KeyCode.A,Dash)
LoadDoubleTap(Enum.KeyCode.S,Dash)
LoadDoubleTap(Enum.KeyCode.D,Dash)
I'll pop back in this later if I remember, a brief video of what happens when you use this and an explanation of the expected behavior would be appreciated. Also I formatted your code for ease of reading.
I just got this fixed and re done as well