How do i position it well no matter where the player is?

So I spawn the things but I face front it work good, I face back it spawns on my back, I spawn on left and it spawns on me? any way to fix so it goes always in front of me the stuff?

Code:

local DSS = game:GetService("DataStoreService")
local Data = DSS:GetDataStore("Data2")
local TS = game:GetService("TweenService")

local function save(plr:Player)
	local save = {
		plr.character.Value
	}
	Data:SetAsync(plr.UserId.."-data",save)
end

game.Players.PlayerAdded:Connect(function(plr)
	local leaderstats = Instance.new("Folder",plr)
	leaderstats.Name = "leaderstats"
	local character = Instance.new("StringValue",plr)
	character.Name = "character"
	character.Value = "default"
	if Data:GetAsync(plr.UserId.."-data")[1] ~= ""  then
		character.Value = Data:GetAsync(plr.UserId.."-data")[1]
	end
	
end)
game.Players.PlayerRemoving:Connect(function(plr)
	save(plr)
end)
game.ReplicatedStorage.Remote.ShowSkillsUI.OnServerEvent:Connect(function(plr,charval,skills)
	print(typeof(skills))
	for i,v in skills do
		local template = plr:FindFirstChild("PlayerGui").Main.Template:Clone()
		template.Ability.Text = v
		template.AbilityKey.Text = i
		template.Parent = plr:FindFirstChild("PlayerGui").Main.Toolbar
		template.Visible = true
	end
end)

game.ReplicatedStorage.Remote.Ability.OnServerEvent:Connect(function(plr,skill)
	print("true",skill)
	if skill == "Hollow Purple" then
		print("skill")
		local rep = game:GetService("ReplicatedStorage")
		plr.Character.Humanoid.WalkSpeed = 0
		plr.Character.Humanoid.JumpPower = 0
		local hollow = rep:FindFirstChild("Skills"):FindFirstChild("Hollow Purple"):Clone()
		hollow.Parent = workspace
		hollow.Red.Orientation = Vector3.new(-180,0,0)
		hollow.Blue.Orientation = Vector3.new(-180,0,0)
		hollow.Purple.Part.Transparency = 1
		for _, v in pairs(hollow.Purple:GetDescendants()) do
			if v:IsA("ParticleEmitter")  then
				v.Enabled = false
			end
		end
		
		hollow:SetPrimaryPartCFrame(plr.Character.Head.CFrame - Vector3.new(0,0.5,7))
		
		--rep.Remote.SetCameras:FireClient(plr,CFrame.new(plr.Character.Head.Position + Vector3.new(0,0,-10)))
		TS:Create(hollow.Red,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,1),{CFrame = plr.Character.Head.CFrame + Vector3.new(0,0,-7)}):Play()
		TS:Create(hollow.Blue,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,1),{CFrame = plr.Character.Head.CFrame+ Vector3.new(0,0,-7)}):Play()
		task.wait(2)
		TS:Create(hollow.Red,TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,1),{Color =Color3.fromRGB(170,100,255)}):Play()
	
		TS:Create(hollow.Blue,TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,1),{Color =Color3.fromRGB(170,100,255)}):Play()

		task.wait(2.5)
		hollow.Purple.Part.Transparency = 0
		for _, v in pairs(hollow.Purple:GetDescendants()) do
			if v:IsA("ParticleEmitter")  then
				v.Enabled = true
			end
		end
		hollow.Purple.CFrame = plr.Character.Head.CFrame+ Vector3.new(0,0,-7)
		hollow.Red:Destroy()
		hollow.Blue:Destroy()
		
	end
end)
hollow:SetPrimaryPartCFrame(plr.Character.Head.CFrame * CFrame.new(0,0.5,7))

I think this might fix it

1 Like

it fixed the side thing but the positioning gets weird + back issue is still there but thanks for responding!

1 Like

also i noticed when ur rotated the things go to the same point as if u were at front

Yeah when cframes are added together it offsets based on the part, so if the head was tilted then the position will also be tilted since it’ll go above the head,

Does this fix it?

hollow:SetPrimaryPartCFrame(plr.Character.Head.CFrame * CFrame.new(0,0,-7) - vector3.new(0, 0.5, 0))
1 Like

the positioning its good but when i tween the red and blue things they go to my head

i fixed it by playing around with some vectors thanks for ur response!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.