#Help with this code

1 messages · Page 1 of 1 (latest)

sage sigil
#

My problem here is that when try to add a print statement each time a part appears an error occurs but when I do not add the print statement in my code, it work perfectly fine. How do I add a print statement without receiving any errors?

local yelo = workspace.yaalow

local function createpart(gello)
local gello = Instance.new("Part")
local particle = Instance.new("ParticleEmitter")
gello.Parent = workspace
particle.Parent = gello
task.wait(2)
gello:Destroy()

end

yelo.Touched:Connect(function(otherpart)
local op = otherpart.Parent:FindFirstChild("Humanoid")
if op then
createpart(yelo)
print("nnn")

end    

end)

fair wing
#

What’s the error

inner linden
#

hi friend, I'm gonna take a look. Although please put you're text in block code doing the following.

  print("Cool Block Code!")
#
local yelo = workspace.yaalow

local function createpart(gello) -- this parameter is not needed since you're defining what gello is in the line below
    local gello = Instance.new("Part")
    local particle = Instance.new("ParticleEmitter")
    gello.Parent = workspace
    particle.Parent = gello
    task.wait(2)
    gello:Destroy()
end

yelo.Touched:Connect(function(otherpart)
    local op = otherpart.Parent:FindFirstChild("Humanoid")
    if op then
        createpart(yelo) -- you're passing the useless parameter that gets deleted in the first line of "createpart" function"
    print("nnn")

    end
end)

--although a print shouldnt break you're code and this code should probably work... i suggest doing workspace:WaitForChild("yaalow") to ensure it loads.
--lmk what the error is saying so i can follow up with more help. feel free to ping me.
sage sigil
#

for some reason it's working now