So I made a script that creates a pillar that shoots up into the sky, the problem however. Is that I also need it to go through the baseplate, how can I do that using scripting?
Edit: Essentially, the script works like this: When I press a key, a pillar will spawn at your mouses position. However, when I press it anywhere near a player, it goes over said players head. I thought that by sinking it through the baseplate, that problem could be fixed. But I honestly don't know what to do and if anyone has any better ideas let me know.
Note: This is only on the receiving end of a remote, so not all variables will be stated, but you can probably guess based on what they are called and how they are used
game.ReplicatedStorage.FireTower.OnServerEvent:Connect(function(player,mousehit)
local char = game.Players[player.Name].Character
local hum = char.Humanoid
local root = char.HumanoidRootPart
local fireTower = Instance.new("Part",workspace)
local fire = game:GetService("ServerStorage").Fire:Clone()
fire.Parent = fireTower
fireTower.Name = "fireTower"
fireTower.BrickColor = BrickColor.new("Deep orange")
fire.Size = NumberSequence.new(1)
fireTower.Shape = Enum.PartType.Cylinder
fireTower.CFrame = mousehit
fireTower.Size = Vector3.new(999,10,10)
fireTower.Orientation = Vector3.new(0, 0, 90)
fireTower.Material = Enum.Material.Neon
fireTower.Transparency = 0.5
fireTower.Anchored = true
fireTower.CanCollide = false
game.Debris:AddItem(fireTower, 6)
wait(3)
local tween = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.In,0,false,0)
local tweenProperty = {Size = Vector3.new(999,20,20)}
local tweenRun = tween:Create(fireTower,tweenInfo,tweenProperty)
tweenRun:Play()
ten = true
fireTower.Touched:connect(function(hit)
if not ten then return end
ten = false
local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
if ehum and ehum ~= hum then
ehum:TakeDamage(30)
local debrisService = game:GetService("Debris")
local fire = game:GetService("ServerStorage"):FindFirstChild("Fire")
for _, v in pairs(hit.Parent:GetChildren()) do
if v:IsA("BasePart") then
if not v:FindFirstChild("ParticleEmitter") then
local fireClone = fire:Clone()
fireClone.Parent = v
debrisService:AddItem(fireClone, 5) -- removes the object in 5 seconds
end
end
end
for i = 1, 10 do
hit.Parent.Humanoid:TakeDamage(3)
wait(0.5)
end
ten = true
else
return nil
end
end)
end)

2 comments
Collisions, my friend.
Can you elaborate?