It’s my first time trying with viewport frame, it will display a part
the script:
local part = Instance.new("Part",script.Parent.ViewportFrame)
local vpf = script.Parent.ViewportFrame
local runservice = game:GetService("RunService")
local cam = Instance.new("Camera",vpf)
vpf.CurrentCamera = cam
runservice.RenderStepped:Connect(function()
if part ~= nil then
cam.CFrame = part.CFrame + Vector3.new(5,5,5)
cam.CFrame = CFrame.lookAt(cam.CFrame.Position,part.Position)
vpf.CurrentCamera = cam
end
end)
why it don’t work
2 Likes
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 9:55am
#2
Hmm, I really don’t know try double check the script for some errors just play inside the game and press F9 to check.
1 Like
I checked it, no error is printed neither it works
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 9:56am
#4
Can you send me the GUI in a message? I will check for you.
how to send gui in a message? how to do it
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 9:58am
#6
Or else try to turn your place into a file and sent it to me
ViewportTest.rbxl (24.6 KB)
ok i sent
3 Likes
The camera should be parented to the viewportframe
1 Like
oh! i did not know it sorry i thought i can be anywhere
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 10:07am
#10
Yep, that really helped fixed it.
wait isnt it in the viewport frame?
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 10:08am
#12
No it was not their I think you forgot to put it.
local vpf = script.Parent.ViewportFrame
local runservice = game:GetService("RunService")
local cam = Instance.new("Camera",vpf)
uh? its in viewport frame?
1 Like
I test your script and its still work fine for me
1 Like
check the link i sent, why it don’t work in my game
no? it works in your game the script then why not in my game to, thats why u said
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 10:14am
#18
Yeah I know but now its broken again…
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 10:14am
#19
I don’t know why is it doing that.
uh? its broken in your game? so the viewport frame property is working sometimes? no right
josefbal4
(PlayJ03efsMusic)
June 5, 2021, 10:16am
#21
Yeah first it fixed it and its broken again for some reason…