I tried to make a yellow ball which i stored in lighting hover over the player's head when they touch a brick, however, the ball welds to a strange place several studs behind and under the player's torso. Here's my code:
brick = script.Parent
brick.Touched:connect(function(h)
ishuman = h.Parent:FindFirstChild('Humanoid')
if ishuman then
p = game.Lighting.a:Clone()
p.Parent = game.workspace
s = Instance.new("Weld")
s.Parent = h.Parent.Torso
s.Part0 = h.Parent.Torso
s.C0 = h.Parent.Torso.CFrame:inverse()
s.Part1 = p
s.C1 = p.CFrame:inverse()
p.CFrame = h.Parent.Torso.CFrame * CFrame.new(0,3,0)
end
end)

1 comment
Why did you store it in lighting? This is 2016 not 2008 Why not use ReplicatedStorage?