How do I make better lava

Hi, I want to make a lava that sends you up and deals 35 damage on touch. I tried changing velocity but its not the effect that I want to receive. Sometimes lava not sends you up(maybe because player is still mid air) and if you stand still, the touch is not being detected and you don’t take damage

Here’s a script I’m using

local damagePlayers = {}

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		if not table.find(damagePlayers, hit.Parent) then
			table.insert(damagePlayers, hit.Parent)
			hit.Parent.Humanoid:TakeDamage(25)
			wait()
			hit.Parent.Humanoid.JumpPower = 100
			hit.Parent.Humanoid.Jump = true
			wait(0.1)
			hit.Parent.Humanoid.JumpPower = 50
			wait(0.3)
			table.remove(damagePlayers, table.find(damagePlayers, hit.Parent))
		end
	end
end)

I also created a hitbox that is welded to player

1 Like

I think you can insert a BodyPosition into the player’s HumanoidRootPart that positions it upwards, then destroy it shortly.

--put this just after the wait() in the event
local bodyPos = Instance.new("BodyPosition")
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyPos.D = 1250
bodyPos.P = 10000 --alter this property to change the force of the upwards boost
bodyPos.Position = hit.Parent.HumanoidRootPart.Position + Vector3.new(0, 10, 0)
bodyPos.Parent = hit.Parent.HumanoidRootPart
wait(.1)
bodyPos:Destroy()
bodyPos = nil
1 Like

Thanks alot, but I have another problem now. I used Region3 for better touch detection, and after this you can take double or triple damage, its like its ignoring the table

Maybe having a longer cooldown might work?

I tried doing it, and you taking still taking more damage, if I put longer wait, you will take damage for example in 5 seconds

What about instead of inserting hit.Parent in the table, try inserting the player from players:GetPlayerFromCharacter().

Uh… It finds the same name, if you want more info about that problem, you can find it here

It’s an instance, not a name.

1 Like

:GetPlayerFromCharacter still not works, same effect

Try inserting the name of the player inside the damagePlayers table, instead of their character (instance). Use hit.Parent.Name.

I have changed this to for loop(for Region3 better detecting), tried your idea and it still not worked.
The post: Problem with tables