#how do i change camera position to a fix position

38 messages · Page 1 of 1 (latest)

vapid sage
#

oh yeah and when i join it goes to position 1 and i cant move or jump :3 (i have no idea how to code)

#

oh nvm lol

#

actually nvm

#

ok code

#

`local plr = game:GetService("Players").LocalPlayer
local Camera = game:GetService("Workspace").CurrentCamera

local function setcam(part)
Camera.CameraType = "Scriptable"
Camera.CFrame = part.CFrame
end

setcam(workspace.SpawnLocation)`

#

source for code is roblox studio forums

quick pewter
#

have a table of locations

local parttable = {workspace.part, workspace.part2, workspace.part3}
local currentpart = 1
local button1 = button1location
local button2 = button2location
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera

local function setcam(part)
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = part.CFrame
end

--cycle up
button1.MouseButton1Click:Connect(function()
    if parttable[currentpart + 1] then
        currentpart = currentpart + 1
        setcam(parttable[currentpart])
    end
end)
--cycle down
button2.MouseButton1Click:Connect(function()
    if parttable[currentpart - 1] then
        currentpart = currentpart - 1
        setcam(parttable[currentpart])
    end
end)
vapid sage
#

what does any of that mean

quick pewter
#

and then just have a number for current

#

basically currentpart is a number

#

you can get a value in a table by doing table[number]

vapid sage
#

ok....

quick pewter
#

so we just increase currentparts number or decrease every time u click

vapid sage
#

yeah makes sense but barely

#

wait

quick pewter
#

clearly u dont have 5 years experience

vapid sage
#

yup

#

ok so uhhh do i add a clicked trigger somewhere

quick pewter
#

1 sec

vapid sage
#

and uhh isnt it supposed to be 2 gui things??? i dont really want to make it global but k

quick pewter
#

edited it

vapid sage
#

ohh

#

ok i just pasted the local things and it got horrible

quick pewter
#

how so

vapid sage
#

circled part is parts i copy and pasted in

#

button1 and button 2 were alr there

#

wait

#

actually now that i look at it its just the currentpart thing

quick pewter
#

1 sec

#

edited again

#

u gotta make these 2 the locations of ur button

#

for example

local button1 = script.Parent.Button
vapid sage
#

i was going to do that after we fixed the current part thing

quick pewter
#

more like fixed ur function

#

u didnt have an end on it

vapid sage
#

o

quick pewter
#

ping me if u need smn