Need help with plugin

So. Im making a load character type of plugin. And i have an option called “Load character at origin”. When its activated. You guessed it. It loads the character model at the origin. But i want the plugin to load the character model where the camera is facing if the option is deactivated.

This is my plugin code that loads the character model atm.

if LOAD_ORIGIN == true then
			DUMMY:SetPrimaryPartCFrame(, 3, 0))
		elseif LOAD_ORIGIN == false then
			local CAM = game.Workspace.CurrentCamera:ScreenPointToRay(game.Workspace.CurrentCamera.CFrame.p.X, game.Workspace.CurrentCamera.CFrame.p.Y)
			local rayParams =
			rayParams.FilterDescendantsInstances = {}
			rayParams.FilterType = Enum.RaycastFilterType.Blacklist
			rayParams.IgnoreWater = true
			local RAY = game.Workspace:Raycast(CAM.Origin, CAM.Direction * 1000)
			if RAY then
				DUMMY:SetPrimaryPartCFrame(, RAY.Position.Y, RAY.Position.Z) +, 3, 0))

See this post maybe it could help you.

1 Like