I haven't added in the damage part of the script part yet, because I knew I would have issues at this point anyway. The Pillar just doesn't show up. I wanted it to only spawn up to 50 studs away, which I hope I did right (if not, I would appreciate some help with doing that). I think it's pretty clear what I tried to do from my script.
I am by no means experienced with this type of stuff, as I mostly work with cafe groups, but I have a general knowledge of roblox Lua anyway. I would also appreciate being informed of anything I can do more efficiently. Thanks in advance.
IntrinsicDamage = 50
tweenServ = game:GetService('TweenService')
tweeninf = TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 1, true, 1)
script.Parent.OnServerEvent:Connect(function(plr)
local charPos = plr.Character.Head.Position
local mousePos = plr:GetMouse().Hit.P
local dist = charPos - mousePos
if dist.X > 50 then
dist.X = 50
end
if dist.X < -50 then
dist.X = -50
end
if dist.Z > 50 then
dist.Z = 50
end
if dist.Z < -50 then
dist.Z = -50
end
local objInf = {
Size = Vector3.new(charPos + 100, 50, 50)
}
local Pillar = Instance.new("Part")
Pillar.Shape = Enum.PartType.Cylinder
Pillar.Orientation = Vector3.new(0, 0, -90)
Pillar.Size = Vector3.new(charPos + 100, 2, 2)
Pillar.Position = dist + charPos
Pillar.Parent = workspace
local Tween = tweenServ:Create(Pillar, tweeninf, objInf )
Tween:Play()
end)

5 comments
Try to parent it before you set position and anchor it.
^ Bad. Never do that.
Always change properties before parenting. It's much more efficient.
I'm pretty sure you can't get the mouse from a server script. Correct me if I'm wrong but that may be your problem.
Try passing the mouse position to the remote event.