ClubCity02
(ClubCity02)
#1
hi so i tried to make egg and pet attach to the player camera but when player hatch egg is with bug.
here is the script:
local RunService = game:GetService("RunService")
game.ReplicatedStorage.ShowOnCam.OnClientEvent:Connect(function(Egg)
Egg.Parent = workspace.Camera
RunService.RenderStepped:Connect(function()
Egg.Position = Vector3.new(3,3,workspace.CurrentCamera.CFrame - 3)
end)
end)
game.ReplicatedStorage.ShowOnCam.OnClientEvent:Connect(function(Pet)
Pet.Parent = workspace.Camera
RunService.RenderStepped:Connect(function()
Pet.Position = Vector3.new(3,3,workspace.CurrentCamera.CFrame - 3)
end)
end)
and the error:
Do this:
local RunService = game:GetService("RunService")
game.ReplicatedStorage.ShowOnCam.OnClientEvent:Connect(function(Egg)
Egg.Parent = workspace.Camera
RunService.RenderStepped:Connect(function()
Egg.Position = Vector3.new(3,3,workspace.CurrentCamera.CFrame.Position.Z - 3)
end)
end)
game.ReplicatedStorage.ShowOnCam.OnClientEvent:Connect(function(Pet)
Pet.Parent = workspace.Camera
RunService.RenderStepped:Connect(function()
Pet.Position = Vector3.new(3,3,workspace.CurrentCamera.CFrame.Position.Z - 3)
end)
end)
1 Like
KJry_s
(MalleoZephyris)
#3
CFrame is the rotation and position of an object.
So you have to change this to something like:
CurrentCamera.CFrame.Position.Z