Why does this script not work?

i added some numbers to the cframe to ajest the camera angle, trying to just not be in the body for now

example of what i am trying to do:

you need to modify it properly, don’t just use some random numbers

if i make it behind the player? would it work normally?

yes… you’ve been asking like 45 questions in the same post

RunService.RenderStepped:Connect(function()
	local character = game.Players.LocalPlayer.Character
	Camera.CFrame = CFrame.new((character.HumanoidRootPart.CFrame * CFrame.new(0, 12, 10)).Position, character.HumanoidRootPart.Position)
end)

this should work approximatively like you want it to. modify it to your needs, also try reading documentations more, like the CFrame or camera one.

1 Like

sorry for asking so much, one last question, how do i prevent the player from spinning when walking backwards? the script:

local rs = game:GetService("RunService")
local camera = workspace.CurrentCamera

rs:BindToRenderStep("LockCamera", 201, function(dt)

	local char = game.Players.LocalPlayer.Character


	camera.CFrame = CFrame.new((char.HumanoidRootPart.CFrame * CFrame.new(0, 5, 6)).Position, char.HumanoidRootPart.Position)
	camera.CFrame = CFrame.lookAt(camera.CFrame.Position, char.HumanoidRootPart.Position)
end)

yeah you’ll have to figure that for yourself bruh i’m done

can you show an example of the problem? i might be able to help

it works fine when i press w, a and d, but when i go backwards, the character just spins uncontrollably shiftlock does that too, i am fine with that because i can disable it(its a bit fast the file size restriction is very annoying

local rs = game:GetService("RunService")
local camera = workspace.CurrentCamera

rs:BindToRenderStep("LockCamera", 201, function(dt)

	local char = game.Players.LocalPlayer.Character


	camera.CFrame = CFrame.new((char.HumanoidRootPart.CFrame * CFrame.new(0, 5, 0)).Position, char.HumanoidRootPart.Position)
	camera.CFrame = CFrame.lookAt(camera.CFrame.Position, char.HumanoidRootPart.Position)
end)

maybe this could work?

works but it is top down, i think the camera is controlling the character is the problem, any idea how to stop that?

do you mind giving me the game file so i can test things?

there is nothing in there exept this:

local rs = game:GetService("RunService")
local camera = workspace.CurrentCamera

rs:BindToRenderStep("LockCamera", 201, function(dt)

	local char = game.Players.LocalPlayer.Character


	camera.CFrame = CFrame.new((char.HumanoidRootPart.CFrame * CFrame.new(0, 5, 0)).Position, char.HumanoidRootPart.Position)
	camera.CFrame = CFrame.lookAt(camera.CFrame.Position, char.HumanoidRootPart.Position)
end) 

the other script is just attaching the cart acessory to the player and add an animation

turns out the humanoid root part rotates when the player trys to go backwards, which causes the camera to start rotating, but im not sure how to fix it

yeah i tried using humanoid.autorotate, but that turns rotation off completely

DevForum’s best solution ever. “bruh im done”. Maybe a part is anchored or something

1 Like

i didn’t know that existed! and now that i know, put this code into a seperate local script in starter player scripts

local uis = game:GetService("UserInputService")
local function inputBegan(object,gameProcessedEvent) 
	if (uis:GetFocusedTextBox()) then return end
	if (object.KeyCode == Enum.KeyCode.S) then
		game.Players.LocalPlayer.Character.Humanoid.AutoRotate = false
	end
end
local function inputEnded(object,gameProcessedEvent) 
	if (uis:GetFocusedTextBox()) then return end
	if (object.KeyCode == Enum.KeyCode.S) then
		game.Players.LocalPlayer.Character.Humanoid.AutoRotate = true
	end
end
OneTimeConnection = uis.InputBegan:Connect(inputBegan)
OneTimeConnection = uis.InputEnded:Connect(inputEnded)

I can’t blame them. They’ve fixed the scripting aspect of it, now OP must deal with the other stuff.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.