Hi have problem with this script.
local part = PART
game:GetService('RunService').RenderStepped:connect(function()
game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(game.Workspace.CurrentCamera.CoordinateFrame.p, part.CFrame.p)
end)
Hi have problem with this script.
local part = PART
game:GetService('RunService').RenderStepped:connect(function()
game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(game.Workspace.CurrentCamera.CoordinateFrame.p, part.CFrame.p)
end)
Like phxntxsmic said, you have to reference the part variable to the parent. And remember that this has to be in a Localscript, since renderstepped only works in the client.
##Script
local part = workspace.Part
game:GetService('RunService').RenderStepped:connect(function()
game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(game.Workspace.CurrentCamera.CoordinateFrame.p, part.CFrame.p)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
The issue is that the 'part' variable is nil. You can't index a nil value, thus, why you are getting an error.
phxntxsmic is right. You need to say where the part is relative to the game or script or something. For example, game.Workspace.Part or script.Parent