Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is wrong with this script?

Hi,

I apologize if this question breaks the rules, tell me if it does. So, I wrote this script, but when I click on the part, nothing happens and no errors show up. What is wrong?

EDIT: when the player clicks, the leaderstat "Value" is supposed to increase.

teapot=script.Parent

function onClicked()             
    teapot.Transparency=1
    teapot.CanCollide=false
onClicked.leaderstats["Value"].Value = onClicked.leaderstats["Value"].Value + 125

end


Thank you!

3 comments

0

Please provide more information on what the script is doing, and try to provide us with any error's that might help.

0

Ok, I did

0

Is this the full script, and is this in a ClickDetector?

1 answer

I don't want to wait for you to paste your entire script, so I'll just give you a working one.

Note: Script must be a normal script inside a ClickDetector inside the part

local teapot = script.Parent.Parent

script.Parent.MouseClick:connect(function(playerWhoClicked)
teapot.Transprency = 1
teapot.CanCollide = false
playerWhoClicked:FindFirstChild("leaderstats").Value = playerWhoClicked:FindFirstChild("leaderstats").Value + 125
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.