How can i spawn a model behind the character, then the model stay in the same emplacement (video + script)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hi, I’m not the best script writer and I need help to try to recreate one mechanic of the “Doors” game. If this is inappropriate and considered unwelcome then feel free not to help me. What I’m trying to achieve is to make the character you see in the video appear behind the player, and then always stay in the same location and continue to move with the player (not move while staying behind the player’s rootpart). Thank all and tell me if it is inapropriate

  2. What is the issue? Include screenshots / videos if possible!

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
repeat wait(1) until game:IsLoaded()
repeat wait(1) until workspace.Route:FindFirstChild('STARTGAME') 

workspace.Son.psst:Play()
game:GetService('RunService').Heartbeat:Connect(function()
	workspace.Maggie.PrimaryPart.CFrame = char.HumanoidRootPart.CFrame - char.HumanoidRootPart.CFrame.LookVector * 3
end)

It looks like in the video, it is doing what you want?

I don’t understand what is the problem?
Or maybe I don’t understand what you are trying to achieve?

1 Like

hello, thank you for your answer, indeed English is not my native language and I sometimes have trouble expressing my thoughts well, I try to rephrase: In the video, you can see that the black character with red eyes still stick to the player’s back, what I’d like is for the black charcater to appear on the player’s back, then it follows the character but no back, so if the player turns around, he comes face to face with the black character with red eyes :sweat_smile:

I try to up this topic thanks !!

I understand. I will see if I can help you wit the script tomorrow.

Not sure if this is what you need, but maybe it will help in some way.
FollowTarget.rbxl (121.5 KB)


image

--Spawn Monster (server script)
script.Parent.Touched:Connect(function(part)
	local player = game.Players:GetPlayerFromCharacter(part.Parent)
	if player and not workspace:FindFirstChild("Monster") then
		local monster = game.ServerStorage:WaitForChild("Monster"):Clone()
		monster:PivotTo(player.Character.PrimaryPart.CFrame + (player.Character.PrimaryPart.CFrame.LookVector * - 2))
		monster.Parent = workspace
		monster:WaitForChild("Target").Value = player.Character
		local code = script.Parent:WaitForChild("MonsterFollow"):Clone()
		code.Parent = monster
		code.Enabled = true
	end
end)
--Remove Monster (Server Script)
script.Parent.Touched:Connect(function(part)
	local player = game.Players:GetPlayerFromCharacter(part.Parent)
	if player and workspace:FindFirstChild("Monster") then
		workspace:FindFirstChild("Monster"):Destroy()
	end
end)

--Follow Script (Server script, inside NPC)
local mob = script.Parent
local target = mob:WaitForChild("Target").Value
local alignOrientation = mob.PrimaryPart:WaitForChild("AlignOrientation")
mob.PrimaryPart:SetNetworkOwner(game.Players:GetPlayerFromCharacter(target))

while target and target.Parent do
	local targetPos = target.PrimaryPart.CFrame + (target.PrimaryPart.CFrame.lookVector * -3)
	alignOrientation.CFrame = CFrame.lookAt(mob.PrimaryPart.Position*Vector3.new(1,0,1),
		target.PrimaryPart.Position * Vector3.new(1,0,1),
		Vector3.new(0,1,0))
	if (target.PrimaryPart.CFrame.Position - mob.PrimaryPart.Position).Magnitude > 5 then
		mob.NPC:MoveTo(targetPos.Position)
	end
	wait(.1)
end

1 Like

wow, you are really good! Thank you very much for your help and your solution ! I hope one day I can find solutions as quickly as you do

1 Like