My trail Attachment Position is not good

Hi there I am GODPOTATO
So, at first, I want to make trail to humanoidrootpart but the trail will appear to the different positon.



My sicript is

local remoteEvents = game.ReplicatedStorage.RemoteEvents.Skills
local Effects = game.ReplicatedStorage.Effects

remoteEvents.Dash.OnServerEvent:Connect(function(player)
	
	local char = player.Character
	local trail = Instance.new("Trail")
	trail.Color = ColorSequence.new(Color3.new(0.952941, 1, 0))
	trail.Parent = char.UpperTorso
	local Attach1 = Instance.new("Attachment")
	local Attach2 = Instance.new("Attachment")

	Attach1.Name = "Attach1"
	Attach1.Parent = char.UpperTorso
	Attach1.Position = char.HumanoidRootPart.Position
	Attach2.Name = "Attach2"
	Attach2.Parent = char.UpperTorso
	Attach2.Position = char.HumanoidRootPart.Position + Vector3.new(0,2,0)
	trail.Attachment0 = Attach1
	trail.Attachment1 = Attach2
	
	wait(3)
	
	trail:Destroy()
	Attach1:Destroy()
	Attach2:Destroy()
	
end)

Some one please solve this.

In addtion, this is local script

local Button = script.Parent
local player = game.Players.LocalPlayer
local remoteEvent = game.ReplicatedStorage.RemoteEvents.Skills
local Key = game:GetService("UserInputService")

Key.InputBegan:Connect(function(KeyCode)
	
	if KeyCode.KeyCode == Enum.KeyCode.E then
		if script.Parent.Parent.CoolDown.Value == 0 then
			remoteEvent.Dash:FireServer(player)
			local Sound = script.Parent.Parent.Wind
			local Character = player.Character
			local Humanoid = Character:FindFirstChild("Humanoid")
			script.Parent.Parent.CoolDown.Value = 15
			Humanoid.WalkSpeed = Humanoid.WalkSpeed * 1.5
			Sound:Play()
			wait(3)
			Sound:Stop()
			Humanoid.WalkSpeed = Humanoid.WalkSpeed / 1.5
		end

		
	end
	
end)

.Position for the attachments is actually an offset, not their actual position in the world.

Change your server code to this:

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local remoteEvents = ReplicatedStorage.RemoteEvents.Skills
local Effects = ReplicatedStorage.Effects

--//Functions
remoteEvents.Dash.OnServerEvent:Connect(function(player)
	if not player.Character then
		return
			
	end
	
	local trail = Instance.new("Trail")
	trail.Color = ColorSequence.new(Color3.new(0.952941, 1, 0))
	
	local Attach1 = Instance.new("Attachment")
	Attach1.Name = "Attach1"
	Attach1.Parent = char.HumanoidRootPart
	
	local Attach2 = Instance.new("Attachment")
	Attach2.Name = "Attach2"
	Attach2.Position = Vector3.yAxis * 2
	Attach2.Parent = char.HumanoidRootPart
	
	trail.Attachment0 = Attach1
	trail.Attachment1 = Attach2
	trail.Parent = char.HumanoidRootPart
	
	task.wait(3)
	trail:Destroy()
	Attach1:Destroy()
	Attach2:Destroy()
end)
1 Like

OMG it work!!!
Thank you very muchhhhh
:smiley:

1 Like

No problem. If you have any more questions, feel free to ask.