Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

What is wrong with this script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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!

0
Please provide more information on what the script is doing, and try to provide us with any error's that might help. YasuYoshida 171 — 9y
0
Ok, I did DrCylonide 158 — 9y
0
Is this the full script, and is this in a ClickDetector? YasuYoshida 171 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)
Ad

Answer this question