I do not know the issue. But whenever the BP is used it just positions me to somewhere random? Its supposed to be a jump, and holds the player in air while a projectile fires. (A jump kind of effect into the air) I don't know the problem, but I have attached my script to this thread. Please help!
-- Variables local UIS = game:GetService("UserInputService") local Cam = script:WaitForChild("CamShake") local ButtonEvent = script:WaitForChild("BtnDown") local plr = game.Players.LocalPlayer local Mouse = plr:GetMouse() local Debounce = true local BtnDown = false Player = game.Players.LocalPlayer Char = Player.Character --- Functions: local Tool = script.Parent Tool.Equipped:Connect(function() Tool.Equip.Value = true end) Tool.Unequipped:Connect(function() Tool.Equip.Value = false end) --- Keybind UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.Z and Debounce == true then Debounce = false --and Tool.Equip.Value == true and Tool.Active.Value == "None" then BtnDown = true --Tool.Active.Value = "WindSlam" local Charge = 0 script.Function:FireServer(Mouse.Hit.p) local BG = Instance.new("BodyGyro") BG.Parent = Char.HumanoidRootPart BG.MaxTorque = Vector3.new(250000,250000,250000) BG.CFrame = CFrame.new(Char.HumanoidRootPart.Position, Mouse.Hit.p) BG.P = 25000 BG.D = 140 local BP = Instance.new("BodyPosition") BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BP.P = 15000 BP.D = 1250 BP.Position = Char.HumanoidRootPart.Position BP.Parent = Char.HumanoidRootPart while BtnDown == true and Charge < 40 do BG.CFrame = CFrame.new(Char.HumanoidRootPart.Position, Mouse.Hit.p) Charge = Charge + 1 wait() end BG:Destroy() BP:Destroy() ButtonEvent:FireServer() end end) UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.Z and Tool.Equip.Value == true and Tool.Active.Value == "None" then BtnDown = false Tool.Active.Value = "WindSlam" wait(1.5) Tool.Active.Value = "None" wait(3) Debounce = true end end) -- Camera Shake function cameraShake() local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") for i = 1, 40 do local a = math.random(-100, 100)/100 local b = math.random(-50, 50)/100 local c = math.random(-100, 100)/100 Humanoid.CameraOffset = Vector3.new(a,b,c) wait() end Humanoid.CameraOffset = Vector3.new(0,0,0) end Cam.OnClientEvent:Connect(function() cameraShake() end)
I used to use BodyPositions to hold the player in place while firing a move. When I tried your properties, they kind of flung me all over the place. I suggest using a combination of BodyPosition and BodyGyro to help stabilize the player.
local BG = Instance.new("BodyGyro") BG.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) BG.P = 8500 BG.D = 500 BG.Parent = Char.HumanoidRootPart BG.CFrame = CFrame.new(Char.HumanoidRootPart.Position, Mouse.Hit.Position) local BP = Instance.new("BodyPosition") BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BP.P = 15000 BP.D = 1250 BP.Position = Char.HumanoidRootPart.Position BP.Parent = Char.HumanoidRootPart
Your issue could be with changing the properties after parenting, which could lead to the BodyPosition's default properties going into play on the physics engine before you set the new ones.
If you have charging or delayed attacks, make sure to update the Gyro's CFrame to the new mouse position every frame.
u didnt rlly explain why u need to use this so i assume you would want to teleport a player somewhere so u can simply make a part where u want to teleport them make it invisible and and can collide of and use this (I EDITED THE ANS)
Char.HumanoidRootPart.CFrame = Char.Head.CFrame + Vector3.New(0, 5, 0)
this should teleport the player slightly above their head then u can anchor the player or whatever u want to keep it in air the unanchoore the player to get it back down