I am trying to script a cutscene for when you transform in my game. The code isn’t running properly.
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local c = plr.Character
local cam = workspace.CurrentCamera
game.ReplicatedStorage.cam.OnClientEvent:Connect(function()
local P = Instance.new("Part",workspace)
P.CFrame = c.HumanoidRootPart.CFrame * CFrame.new(0,0,2)
P.Anchored = true
P.CanCollide = false
cam.CameraType = "Fixed"
cam.Focus = P.CFrame
end)
I am trying to make a part spawn wherever you are so the cutscene works anywhere.
Have you tried manipulating the camera’s CFrame?
I believe you need to enclose your CFrame location inside of the CFrame.new()
P.CFrame = CFrame.new(c.HumanoidRootPart.CFrame * CFrame.new(0,0,2))
ezekieltem
(Not_ezekieltem)
November 28, 2020, 6:17am
#4
Try setting the camera type to Scriptable
I did that earlier didn’t work.
Yes I have tried and it didnt work
Quick question. Would I have to spawn the part on the server then send it to the client? maybe cameras require server sided parts
ezekieltem
(Not_ezekieltem)
November 28, 2020, 6:20am
#8
Wait is this a local script or normal script? And where is it located?
If you wanted to access that part from multiple localscripts then yes (I am unsure if you can access the same locally made part via _G or modulescripts), you would need to spawn it from the server. But I don’t think that’s the problem.
ezekieltem
(Not_ezekieltem)
November 28, 2020, 6:26am
#10
Because if it is a local script please make sure it is in a location where it will run. This Local Script Article on the Developer API will tell you where a local script can run.
Make sure if it is in a localscript and not a script . Localplayer can only be accessed by localscript s.
FerbZides
(FerbZides)
November 28, 2020, 6:53am
#12
it works even if it’s server-sided just even tried it
cc @SimpForLua
I have a module which moves smoothly or hard move on the player’s cam to the desired position if you wanted too!