Why that simple script doesnt work!

  1. What is the issue? Include screenshots / videos if possible!

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Remove the () fro mthe Onclick on the last line, you’re firing the function, not setting it to the event. Also your 2 variables are the same to inform you

1 Like

when you do Connect() you don’t put the function parentheses
so it should look like this:

clickdetector.ClickDetector.MouseClick:Connect(Onclick)
1 Like

No, I cannot add click detector in local, so I did this way

3 its not a Shape :sweat_smile: , use something like “Cilinder”

Also, like embat said, remove the () from Onclick on the last line

function is called but Shape didnt work either .

I assume he wants to change the shape of a part, which would be
currentPart.Shape = Enum.PartType.Ball

1 Like

check out the post pokemoncraft said, it can help as 3 its not a PartType (shape)

1 Like

Also you have:

local currentpart=script.Parent
local clickdetector=script.Parent

They can’t both be script.Parent, most likely clickdetector should be:

local clickdetector=script.Parent.ClickDetector

Enum items come together with values. You can represent them in 3 ways:

-- Their name:
"Ball"
-- Their value: 
0
-- And of course, the enum itself:
Enum.PartType.Ball

Although in our case, 3 is a non-existent value, according to the DevHub page about it: (PartType | Roblox Creator Documentation)

Just gonna add this:

image

Values 0-2 are PartTypes, but 3 is not

3 Likes