hi! iv made a fighting animation for a character but it involves movement. i don’t know if i animate the character still and add movement in the script or do i animate the whole punching and the movement with one animation? and does that bring the camera with it?
i am trying to make a dash ability that damages any players that it moves into.
the script is in the character and the animation is part of the script, script is local.
is there also a better way to do this? such as using module scripts?
this is what i have so far:
b = false
UserInputService.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.E and (not gpe) then
if b == false then
b = true
Controls:Disable()
--the ability stuff
char:SetPrimaryPartCFrame(char:GetPrimaryPartCFrame()*CFrame.new(0, 0, -5)) -- this only teleports it foward, but i want it to move with animation, with the cam going along it
Controls:Enable()
b = false
end
end
end)
i disable controls so they cant move while the ability move is playing
edit:
I need to move the character forward, in a straight line that is not affected by gravity and can be stopped by a wall. then the animation plays while the character moves forward like how roblox does its jumps. how would I do this.
Why are you teleporting the character forward? Use AssemblyLinear Velocity for that.
1 Like
on the forum, it says assembly linear velocity property of the base part. what does the base part mean? And also how can I move forward due to the way I am facing? It’s a vector3 so do I do vector3.new()?
Correct
A basepart, is well, a part
You will have to do Vector3.new(), yes, and you’ll have to put the Attachment zero of the base part (HumanoidRootPart, in this case) just oppoiste to the direction you want to dash in
Check this document
https://developer.roblox.com/en-us/api-reference/class/VectorForce
there seems to be no info on how it can be used, and using vector force still applies gravity to movement, I’m trying to move the character unrealistically such as what this says;
https://developer.roblox.com/en-us/api-reference/property/BasePart/AssemblyLinearVelocity
using this I tried moving a part such as forward then up but it doesn’t seem to work…
part = script.Parent
vectorforce = script.Parent:WaitForChild("VectorForce")
local vc = part:GetVelocityAtPosition(vectorforce)
print(vc) -- lol i have no clue what im doing here
part.AssemblyLinearVelocity = part.AssemblyLinearVelocity + Vector3.new(0,0,-5)
I’m trying this on a part before trying on rootpart. also thank you for helping.
edit after couple hours:
I did some more research and messed around a bit and it started to work! But I’m still having problems stopping the character midair for one second so it doesn’t slide when they land.
this is what I did
local Attachment = Instance.new("Attachment")
Attachment.Parent = HumanoidRootPart
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.VectorVelocity = HumanoidRootPart.CFrame.LookVector * 250
LinearVelocity.MaxForce = math.huge
LinearVelocity.Attachment0 = Attachment
LinearVelocity.Parent = Attachment
wait(0.01)
LinearVelocity.MaxForce = 0
LinearVelocity.VectorVelocity = HumanoidRootPart.CFrame.LookVector * 0
-- me trying to pause the character midair
Attachment:Destroy()
LinearVelocity:Destroy()