Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Stop camera from moving when holding onto a ledge?

Asked by 2 years ago

So while working on my game i came upon two problems that i don't find a way to fix. The first problem is that when the player is holding onto an edge i want him to be able to move his head in each direction a bit ( not to be able to do a 360 ) and not his entire body like roblox def settings do. The second problem i found is that when the player is holding on a ledge the left arm animation is glitching , i tried remaking the anim but still doesn't work. Also the game is first person only.

Here is the ledge grabbing script : P.S i tried using the CameraType but doesnt work.

01local plr = game.Players.LocalPlayer
02local Character = plr.Character or plr.CharacterAdded:Wait()
03local Root = Character:WaitForChild("HumanoidRootPart")
04local Head = Character:WaitForChild("Head")
05local Hum = Character:WaitForChild("Humanoid")
06local CA = Hum:LoadAnimation(script:WaitForChild("ClimbAnim"))
07local HA = Hum:LoadAnimation(script:WaitForChild("HoldAnim"))
08local TouchGui = plr:WaitForChild("PlayerGui"):FindFirstChild("TouchGui")
09local UIS = game:GetService("UserInputService")
10local Camera = workspace.CurrentCamera
11 
12ledgeavailable = true
13holding = false
14 
15while game:GetService("RunService").Heartbeat:Wait() do
View all 66 lines...

and here is the first person camera script :

001repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil
002local runService = game:GetService("RunService")
003local input = game:GetService("UserInputService")
004local players = game:GetService("Players")
005 
006CanToggleMouse = {allowed = true; activationkey = Enum.KeyCode.F;} -- will only be used for studio work
007CanViewBody = true     
008Sensitivity = 0.2      
009Smoothness = 0.05  
010 
011local cam = game.Workspace.CurrentCamera
012local player = players.LocalPlayer
013local m = player:GetMouse()
015local character = player.Character or player.CharacterAdded:wait()
View all 149 lines...

If someone can help me it would be awesome.

0
here's a video with the issues : https://youtu.be/CjbNPkSzvyU TheD4rkPow3r_WFE 13 — 2y
0
Managed to fix the glitching arm , the problem came from the models hitbox as it was imported from blender. TheD4rkPow3r_WFE 13 — 2y

Answer this question