Hello, i am trying to do my own swingbar system for my parkour game, but my character goes to only one direction.
-
What do you want to achieve? Keep it simple and clear!
I want to make the player boost where he is looking right now. -
What is the issue? Include screenshots / videos if possible!
Player only boosting in one side instead of boosting in the direction he’s looking -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried editing script, but it still doesn’t work well. I can’t really look on the developer hub since i don’t know how to describe my problem so it can find any solutions.
My swingbar server script:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:IsA("Model") then
script.Parent.CanTouch = false
local rootpart = hit.Parent.HumanoidRootPart
local sound = script.Parent.swoosh
local idle = hit.Parent.Humanoid:LoadAnimation(script.Parent.SwingIdle)
idle:Play()
hit.Parent.Swinging.Value = true
hit.Parent.HumanoidRootPart.Anchored = true
hit.Parent.HumanoidRootPart.CFrame = script.Parent.Parent.PositionPart.CFrame
game.ReplicatedStorage.SwingbarRE.OnServerEvent:Connect(function()
if hit.Parent.Swinging.Value == true then
hit.Parent.Swinging.Value = false
local jump = hit.Parent.Humanoid:LoadAnimation(script.Parent.SwingJump)
idle:Stop()
jump:Play()
local SoundClone = sound:Clone()
SoundClone.Parent = rootpart
SoundClone:Play()
rootpart.Anchored = false
local boost = Instance.new("BodyVelocity")
boost.MaxForce = Vector3.new(1,0.6,1) *30000
boost.Velocity = rootpart.CFrame.LookVector * 75
boost.Parent = rootpart
wait(0.35)
boost:Destroy()
hit.Parent.HumanoidRootPart.Anchored = false
wait(0.5)
script.Parent.CanTouch = true
end
end)
end
end)