What do you want to achieve? Keep it simple and clear!
I want to make a Dive Script so for whenever a player presses “E” on their keyboard they will dive.
What is the issue? Include screenshots / videos if possible!
It doesn’t dive me forwards instead my character just falls down when I press “E”.
Here I have a video of my problem.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried different ways such as animations & modifying the humanoidrootpart’s CFrame.
I searched Youtube & the Dev Forum for any help with my issue and couldn’t find what I was looking for.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- Here is what my code looks like
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.E then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame =
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(-50),0,0)
end
end)
local Player = game:GetService("Players").LocalPlayer
local Character = (Player.Character or Player.CharacterAdded:Wait())
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Input, Chat)
if Input.KeyCode ~= Enum.KeyCode.E or Chat then return end
local CF, Size = Character:GetBoundingBox()
Character:PivotTo(CF * CFrame.new(0, 0, -Size.Y/2) * CFrame.Angles(math.rad(-50),0,0))
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.E then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame =
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(-50),0,0)
game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.LookVector * 5 -- Adjust this to make it more or less pushy
end
end)