#Click detector issue
1 messages · Page 1 of 1 (latest)
the parent of the script is the click detector, not the part
Anything more to say?
move the script so that its parent is the part and not the click detector
cause in your script you are trying to reference the part directly as its parent, which is giving you the wrong object
I moved
** You are now Level 9! **
Now instead of script.Parent.MouseClick you need to get the .MouseClick of the click detector
.MouseClick is an event that comes from the click detector object
Im actually suprised it doesnt give an error ngl
Ok I did it what now
did it work?
Still same Result, I must have done something wrong again
Its definitely giving an error
in your script, attachment needs to be capitalized in Instance.new()
if it isnt then an error will pop up
where is the script located in the explorer?
and is there potentially a different script that is disabling this one?
Checked that
^
All the way up, workspace, server storage, places like that
** You are now Level 14! **
If the script is under server storage it wont run for example
Also you can check if its running by adding a print statement to the start of the script
The part (containing the script and click detector) is in the workplace
hmm
Put a print statement inside of the click function, to see if it is properly reading the input
I put the print script
Once I clicked
The one I asked to be printed
Wasn't
Printed
show script, something is wrong with the event then
to where the lines of code creating the attachment isnt running
ClickDetector.MouseClick:Connect(function(click)
end)
You already have reference to the click detector, so there is no reason to not just use the variable you made, also you removed the mouse click event
which is why it isnt working
change it to what I have above
Still the same result
still no prints or anything?
Nothing unfortunately
send code again, also you can remove the findfirstchild since HiLock mentioned it
you can get the click detector without it
Ok
findfirstchild is useless if you're not checking if the instance is nil, it just gives you a more confusing error (attempt to index nil with ___ instead of ___ is not a valid member of ___)

ik ik i just started lua today
should have been more specific when I said get rid of find first child ig
local part = script.Parent
local ClickDetector = part.ClickDetector
ClickDetector.MouseClick:Connect(function(click)
-- code to make attachement
end)
Do this ^
You went back to trying to get .MouseClick from the part (script.Parent), which doesnt exist
So you needed to keep the click detector variable
send another pic, this is taking longer than expected lol
I think I will do a quick return to Scratch 
oof
explorer aswell
you forgot the update to line 3
ClickDetector.MouseClick
not
script.Parent.MouseClick
remember the parent is the part, and we need the .MouseClick event from the click detector
wait is instance.new cap sensative?
yes
we are fixing a problem where the function isnt running
not attachment
i mentioned it earlier
oh ok
why is ur profile a cucumber
its a turtle :sobb:
its a cucumber
🐢
the name doesnt lie, does it work now tho?
Done
does it work?
Sorry but no
ima crashout if you not send a pic of your script AND explorer
is there still no print or is there an error
explorer should be this, its in workspace @thin coral
No print
ok nvm we need new code
put the print before the attachment code see if it prints
oh
with instance.new
set the parent last
Nothing still
we cant even get the clickdetector working how are we thinking abt the attachment 😭
im gonna crash out, send code
SEND THE PICTURE PLEASE
JUST SCREENSHOT UR WHOLE SCREEN PLZ
OOOOOh NO
THAT GOTTA BE RAGEBAIT
SORRY
bro parent needs to be set last and attachment needs a capital A
local part = script.Parent
local ClickDetector = part.ClickDetector
ClickDetector.MouseClick:Connect(function(click)
local attch = Instance.new("Attachment")
attch.Name = "NodeAttachment"
attch.Position = Vector3.new(0,1,0)
attch.Parent = part
end)
THIS WORKS
the parent doesnt have to be set last, the changes to the other properties will still apply
ive had it in the past where it dosent work because of that
the cucumber can only think about the attachment
weird
did you change the name of the click detector or smth, why is it referenced differently here
bro the unskilled one doesnt even know himself
fulll screen
this is ragebait
PART.CLICKDETECTOR NOT PART.CLICKDETECTORCLICK
Ok ok
That explains so much lol
if he did he could see clickdetectorclick is not a valid member of blah blah blaj

Ok fixed
zyos do u know how to do the '''lua thing
does it work?
crusty ^^^^
wym
You guys won't be angry guys if I say no?
it does ur lying

local part = script.Parent
local ClickDetector = part.ClickDetector
ClickDetector.MouseClick:Connect(function(click)
local attch = Instance.new("Attachment")
attch.Name = "NodeAttachment"
attch.Position = Vector3.new(0,1,0)
attch.Parent = part
end)
copy and paste this
and it will work
Ok boss
i have it in studio and it works
slow
Not tutorial
alr
dont do that
its ok to use a tutorial
Thanks you guys
its wrong to not use one tbf
For helping in my future project to be a great scripter one day
keep it goin