wait so, i completely replaced the original code with this one, not added it to it
Ah, easy fix then! You need to add back the event you made before.
script.Parent.Touched:Connect(OnTouch)
This is what actually makes the function activate.
Remember to change the name of the function youāre activating! As of right now, āOnTouchā doesnāt exist. Youād want it to be āemitSmokeā in this particular instance.
so this goes at the start of the whole code?
Correct! The code block, or the function, goes at the beginning of the script. The events go at the end, such as the āTouched:Connectā event.
i added it at the top and OnTouch gets an orange line under it
As I stated before, you would add that on the bottom, and you need to change āOnTouchā to āemitSmokeā. āOnTouchā does not actually exist, as you havenāt defined it as a function.
but earlier you said correct when i asked if it goes to the start of the script?.. now im confused
When I said ācorrectā, I thought you were referring to the āemitSmokeā function. My bad. I didnāt know you were talking about the event.
As for the code, it would beā¦
-- function here, please don't just copy and paste this into the code. this isn't actual code. this is an example.
script.Parent.Touched:Connect(emitSmoke)
okay then so whats the complete script because im afraid to try stuff now, lol
Donāt be afraid, my friend, I didnāt mean to spook you! Itās like learning to ride a bike. After youāve done it a few times, itās easy!
Weāre here for you on the devforum, feel free to ask questions. Learning is easier when you have people to help you.
alright this all worked except:
1: all the other parts in the group unanchored and got smoke but the part i touched didnt
Thatās odd. I canāt help you much, though, unless you provide more detail. Try putting a print statement inside of the āforā loop?
this was put in the output as red: 21:35:44.069 - Workspace.Regen Parts.Model.Part.Unanchor:9: attempt to perform arithmetic (div) on Instance and number
Ah! I see the issue. Thatās a bit of flavour that the original writer of the script put in; itās purely for aesthetics. You can remove it, and it wonāt cause any issues.
You can remove the
smoke.Size = v / 4
part.
it all worked! thanks! just putting the script here so i can mark the solution box (since some edits were done to the op script i cant solution that)
local function emitSmoke()
for i, v in pairs(script.Parent.Parent:GetChildren()) do
v.Anchored = false
local smoke = Instance.new(āSmokeā)
smoke.Parent = v
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
end
wait(5) -- Amount of till making smoke dissapear
for i, v in pairs(script.Parent.Parent:GetChildren()) do
v.Smoke:Destroy()
end
end
script.Parent.Touched:Connect(emitSmoke)
Youāre very welcome, my friend! I hope this helps your game out, or just with general scripting knowledge.
Yes! It indeed helped my game out a lot! Idk if this counts as self advertise or something but the game is called size changer feel free to check it out (made by kiri1234jojo if it helps to find it)
Well, Iām glad it worked out. Have a good rest of your week everyone, and stay safe!