I only added the trail thingy and now the whole script isnt working. Anyone pls help me? I only have 2 weeks experience in scripting so im not that good i dont know much…
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local head = character:WaitForChild("Head")
local originalWalkSpeed = humanoid.WalkSpeed
local skillReady = true
local trail = game.ServerStorage:FindFirstChild("PhantomTrail"):Clone()
local attachment0 = Instance.new("Attachment", head)
local attachment1 = Instance.new("Attachment", humanoidRootPart)
trail.Parent = head
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
attachment0.Name = "TrailAttachment0"
attachment1.Name = "TrailAttachment1"
local function onCharacterAdded(newCharacter)
humanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart")
originalWalkSpeed = humanoid.WalkSpeed
end
player.CharacterAdded:Connect(onCharacterAdded)
local function teleportForward()
local lookVector = humanoidRootPart.CFrame.LookVector
local currentCFrame = humanoidRootPart.CFrame
local newPosition = currentCFrame.Position + (lookVector * 5)
humanoidRootPart.CFrame = CFrame.new(newPosition, newPosition + lookVector)
end
local function skill()
if humanoid then
trail.Parent = head
skillReady = false
humanoid.WalkSpeed = 0
teleportForward()
wait(0.5)
humanoid.WalkSpeed = originalWalkSpeed
trail.Parent = game.ServerStorage
wait(0.5)
skillReady = true
end
end
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.One and skillReady == true then
skill()
end
end)
maybe try this ( i just edited a little thing, another error is that this is local script, u should not clone things on the local side
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local head = character:WaitForChild("Head")
local originalWalkSpeed = humanoid.WalkSpeed
local skillReady = true
local trail = game.ServerStorage:FindFirstChild("PhantomTrail"):Clone()
local attachment0 = Instance.new("Attachment", head)
local attachment1 = Instance.new("Attachment", humanoidRootPart)
trail.Parent = head
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
attachment0.Name = "TrailAttachment0"
attachment1.Name = "TrailAttachment1"
local function onCharacterAdded(newCharacter)
humanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart")
originalWalkSpeed = humanoid.WalkSpeed
end
player.CharacterAdded:Connect(function(char)
onCharacterAdded(char)
end)
local function teleportForward()
local lookVector = humanoidRootPart.CFrame.LookVector
local currentCFrame = humanoidRootPart.CFrame
local newPosition = currentCFrame.Position + (lookVector * 5)
humanoidRootPart.CFrame = CFrame.new(newPosition, newPosition + lookVector)
end
local function skill()
if humanoid then
trail.Parent = head
skillReady = false
humanoid.WalkSpeed = 0
teleportForward()
wait(0.5)
humanoid.WalkSpeed = originalWalkSpeed
trail.Parent = game.ServerStorage
wait(0.5)
skillReady = true
end
end
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.One and skillReady == true then
skill()
end
end)