I know how to do this, But it just isn't working. Everything else in this code works. I want to position the new part to the person that died's torso.
Any help would be appreciated!
Here is the code:
--Created by KordGamer game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function(Died) for i =1,script.GoldCount.Value do local xp = Instance.new("Part") xp.Parent = game.Workspace xp.Position = Vector3.new(character.Torso.Position + Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))) xp.Shape = 0 xp.formFactor = "Symmetric" xp.Name = "XP" xp.BrickColor = BrickColor.new(24) xp.Reflectance = 0.5 xp.Size = Vector3.new(1,1,1) local clone = script.Increase:Clone() clone.Disabled = false clone.Parent = xp end end) end) end) --Created by KordGamer
As I said, Everything else works apart from the position part. It just positions it to the center of the BasePlate
, AKA Workspace
.
I tested the script and It seems to work. So here:
game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function(Died) print(character.Name) local Part = Instance.new("Part" , game.Workspace)-- This create the Part and puts the Part inside of Workspace Part.Anchored = true--This is to make sure the part doesn't fall into the void and gets deleted. Part.CFrame = character.Torso.CFrame--This CFrame the Parts position to the Torso's Location. end) end) end)
If you don't understand the something that I wrote feel free to ask me :) If you want more information about CFrame
then please go to this or ask me!:
CFrame
Simple answer:
xp.CFrame = Vector3.new(character.Torso.Position) + Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))
It should work, but if it doesn't contact me!