local db = false local sword = script.Parent.Parent.Parent.ClassicSword script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if db == false then local spawnpad = script.Parent.Parent.SpawnPad.Position db = true sword:Clone().Parent = game.Players[hit.Parent.Name].Backpack hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(spawnpad)) end end end)
First, Vector3.new(spawnpad)
is traduced to Vector3.new(Vector3.new(100, 0, 100))
, or what position the spawn pad is at. It should be simply spawnpad
, not Vector3.new(spawnpad)
.
And the second problem is that the HumanoidRootPart
's position is in the middle part of the character, so the Y position should be bigger with 3.
This is how the code should be:
local db = false local sword = script.Parent.Parent.Parent.ClassicSword script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if db == false then local spawnpad = Vector3.new(script.Parent.Parent.SpawnPad.Position.X,Vector3.new(script.Parent.Parent.SpawnPad.Position.Y + 3, Vector3.new(script.Parent.Parent.SpawnPad.Position.Z) db = true sword:Clone().Parent = game.Players[hit.Parent.Name].Backpack hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(spawnpad)) end end end)