Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Part Spawns Next to Player What I do Wrong?

Everytime the tool is used the part either spawns to the left or the right of the player instead of infront

bin = script.Parent


enabled = true

local function fired()
	
if not enabled then
		return
	end
 
	local character = script.Parent.Parent
	local player = game.Players:FindFirstChild(character.Name)
	if player == nil then return end
     enabled = false
		game:GetService("Chat"):Chat(player.Character.Head, "Steel Release: Steel Wall!")
		local animTrack = player.Character.Humanoid:LoadAnimation(script.Parent.Handsigns)
		animTrack:Play()
		wait(0.8) --0.7
		local SteelWall = Instance.new("Part")
		SteelWall.BrickColor = BrickColor.new("Medium stone grey")
		SteelWall.Size = Vector3.new(4, 65.99, 107.05)
		SteelWall.TopSurface = "Smooth"
		SteelWall.Material = "DiamondPlate"
		SteelWall.BottomSurface = "Smooth"
		SteelWall.Name = ("SteelWall")
		SteelWall.CanCollide = true
		SteelWall.Parent = game.Workspace
		SteelWall.CFrame = player.Character.Torso.CFrame*CFrame.new(0, -0, 5) -- orig -12
		SteelWall.Anchored = true
		local damage = script.Damage2:Clone()
		damage.Disabled = false
		damage.Parent = SteelWall
		--Sparks = Instance.new("ParticleEmitter")
		--Sparks.Parent = EarthBarrier
		--Sparks.Speed = NumberRange.new(1)
		--Sparks.Transparency = NumberSequence.new(0.25,0.25)
		--Sparks.Size = NumberSequence.new(0.7,0.7)
		--Sparks.Rate = 1500
		--Sparks.Lifetime = NumberRange.new(20)
		local RandomNumber = math.random(game.Workspace.EXPRate.MinEXP.Value,game.Workspace.EXPRate.MaxEXP.Value)
		player.stats.XP.Value = player.stats.XP.Value - RandomNumber
		player.stats.Chakra.Value = player.stats.Chakra.Value - 40
		script.Parent.Jutsu:Play()
		wait(0.5)
		for i = 1,20 do
		wait(0.05)
		SteelWall.CFrame = SteelWall.CFrame*CFrame.new(0,.5,0)
		end
		
		game.Debris:AddItem(SteelWall, 10)
wait(10)
enabled = true
end

script.Parent.Activated:connect(fired)




1 answer

Your character's torso position is changing everytime the character falls, jump, walk, and etc. I'd recommend using a loop to update your torso's position everytime.

This discussion is preserved as it was. New answers, comments, and votes are closed.