So i was coding some acid (that would get emited from broken pipelines) But im not quite sure how to go about creating little puddles on the ground. (that dont hurt)
So far ive tried coding it myself and finding things here (on the devforums).
My code:
–Emitter code (parent is the part to emit from)
local serverstor = game.ServerStorage
local SIGNALS = serverstor.SIGNALS
local event = SIGNALS.DropletHit
local m = math
local fall = serverstor.STORAGE.Droplets.Fall
local puddle = serverstor.STORAGE.Droplets.Puddle
event.Event:Connect(function(X, Z, Part)
if Part.ClassName == "Part" then
--baseplate
local clone = puddle:Clone()
local Y = Part.Size.Y + Part.Position.Y
clone.Position = Vector3.new(X, Y, Z)
else
--player
local hum = Part.Character:FindFirstChildOfClass("Humanoid")
if hum then
if hum.Health - 1 < 1 then
SIGNALS.Player_Died:Fire(Part, "WS")
else
hum.Health -= 1
end
end
end
end)
local rate = 10 --per second
local startingsize = 2 -- in studs
while true do
wait(1/rate)
local c = fall:Clone()
c.Droplet_1.Enabled = true
local de = script.Parent.Position
local si = script.Parent.Size
local q = (de.X + m.random(-si.X/2, si.X/2)+0.01)
local w = (de.Y + m.random(-si.Y/2, si.Y/2)+0.01)
local e = (de.Z + m.random(-si.Z/2, si.Z/2)+0.01)
c.Position = Vector3.new(q, w, e)
c.Parent = workspace.Visuals.Droplets
end
this is the way its stored for clarification.
Droplet_1 code:
local droplet = script.Parent
local droplets = workspace.Visuals.Droplets
local S_puddle = workspace.Visuals.SmallPuddles
local Signal = game.ServerStorage.SIGNALS.DropletHit
droplet.Touched:Connect(function(hit)
local tmp = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Name == "Baseplate" then
Signal:Fire(droplet.Position.X, droplet.Position.Z, hit)
droplet:Destroy()
elseif tmp then
Signal:Fire(droplet.Position.X, droplet.Position.Z, tmp)
droplet:Destroy()
elseif hit.Parent == S_puddle then
local tmpval = hit:FindFirstChild("size")
if tmpval then
tmpval.Value += 1.5
end
droplet:Destroy()
end
end)
wait(10)
droplet:Destroy()
droplet_2 code:
local part = script.Parent
local sizeval = part:FindFirstChildOfClass("NumberValue")
local Max = math.max()
sizeval.Changed:Connect(function()
part.Size = Vector3.new(Max(0.005*sizeval.Value, 0.005), sizeval.Value, sizeval.Value)
end)
while true do
wait(0.02)
sizeval.Value -= 0.01
if sizeval.Value < 0.05 then
part:Destroy()
end
end
So it succesfully creates the droplets, But it doesnt make the puddles however it still deals damage to the player, I would need another way to interact with the baseplate other then “touched” event but i have no clue.