#here is some code that isnt working properly

1 messages · Page 1 of 1 (latest)

brave anvil
#

ive tried fixing it but any small change i make errors and the code keeps saying nothing is wrong even though it does nothing

while true do 
    local touching = if script.Parent.Touched then script.Parent:GetTouchingParts(script.Parent:GetTouchingParts() ~= script.Parent.Parent.base) else

     if script.Parent.Parent:GetAttribute("Armed") == true then 
     for i, part in ipairs(touching) do
                local PartN = part
                print(PartN.Name)

if PartN ~= nil and script.Parent.Parent:GetAttribute("Armed") == true then script.Parent.Parent:SetAttribute("Triggered",true) end
if script.Parent.Parent:GetAttribute("Triggered") == true then print("ready")
    repeat 
                        local tick = script.Parent.Parent:GetAttribute("TriggerTime") - 1
                        if script.Parent.Parent:GetAttribute("TriggerTime") ~= 0 or script.Parent.Parent:GetAttribute("TriggerTime") <0  then
                        script.Parent.Parent:SetAttribute("TriggerTime",tick)
                        print(tick) end
                    until script.Parent.Parent:GetAttribute("TriggerTime") == 0 or script.Parent.Parent:GetAttribute("TriggerTime") <0
end 

if script.Parent.Parent:GetAttribute("Explode") == true then 
    local explosion = Instance.new("Explosion")
    explosion.BlastRadius = script.Parent.Parent:GetAttribute("BlastRad")
    explosion.BlastPressure = script.Parent.Parent:GetAttribute("Strength")
    explosion.DestroyJointRadiusPercent = script.Parent.Parent:GetAttribute("DestroyRad")
    explosion.Position = script.Parent.Parent.base.Position
                    print("boom")
                    
end
end wait(0.01)
end
end wait(0.01)
end
patent quail
brave anvil
#

ts messin me up just by existing

#

ill be back later(hopfully not a week)

cyan peak
#

send it as a lua file

#

i dont even think thats the problem, you might just be crazy

brave anvil
#

K

cursive arrow
# brave anvil ive tried fixing it but any small change i make errors and the code keeps saying...

if script.Parent.Touched then touched is an event that you connect to, it is not anything else. it doesn't return anything on it's own. it's kind of like a function. local thing = print; for k,v in thing do print(k,v,"was printed") bruh. what's more concerning though is that you're having at this blindly. you need to learn basic scripting skills to do debugging. i suggest you start here instead of chatgpt: https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals

#

youtube is good too, lots of people recommend brawldev