I’m making this simple rising lava script, but I made it so whatever part that touches the rising lava, turns into a orange neon block which is unanchored. However, it checks if the part is a child of the map, which is correct because when running the script it is touching the parts related to the chosenMap.
Here is part of the script where my issue is occuring.
(note: there are no errors, just the warn is being outputted)
local LavaDamage = newLava.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(100)
end
if workspace.ChosenMap[chosenMap]:IsAncestorOf(hit) then
hit.Name = "LavaPart"
hit.Anchored = false
hit.BrickColor = BrickColor.new("Neon orange")
hit.Material = Enum.Material.Neon
print(hit.Name)
else
warn("part touched is not called Part")
end
end)
The risinglava has cancollide set to false, therefore this should work.
I’ve looked all over the dev forum and cannot find anything that is related to my issue. I hope my issue can be resolved, let me know if you need more information.
Unfortunately, this doesn’t work. I think it is the opposite of what you had said but it still passes the warn() which confuses me. The chosenMap is a string of the chosen map that has been passed from a bindable event.
Try replacing workspace.ChosenMap[chosenMap]:IsAncestorOf(hit) with hit:IsDescendantOf(workspace.ChosenMap[chosenMap]).
Other than that, it works with no warning unless player touches. Not sure what you’re having problems with unless you’re talking about parts outside the chosen map messes around with it.
Would like to hear a follow-up on clarifications to solve it.
I’ll just send a video here showing my issue, following the code I sent above.
It outputs the warn but you can’t see it cause I covered it up accidentally.
All parts you see on the map (except for the grass etc.) is a child of the chosenMap model, and it still confuses me why it doesn’t work.
The script you provided apparently works properly. You should consider try using hit:IsDescendantOf(workspace.ChosenMap[chosenMap]) or try debugging since this is more of game system related or variable issues we do not have access to and only you do.
Using Roblox’s built-in debug will allow you to pause at certain point of the script and understand the issue. Consider printing chosenMap to get the string or come up with ways to read the problem.
Sorry if this is all the developer forum could do for you, but debugging only works in this case.
Hi, sorry for the late reply. I did more digging and found out Overlap Params worked great for this and is currently working how I intended it to. However thank you for trying to help me, I appreciate it.