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

What is wrong with the end) in line 5?

Asked by 10 years ago

I dont know how to fix this but i know it is in line 5

01local cV = Instance.new("IntValue")
02cV.Name = "clickedValue"
03cV.Parent = plr.PlayerGui
04cV.Value = 1
05end)
06 
07script.Parent.MouseClick:connect(function(plr)
08 
09local pCV = plr:FindFirstChild("clickedValue")
10local pLS = plr:FindFirstChild("leaderstats")
11local pP = pLS:FindFirstChild("Points")
12local price = 10
13 
14if pP < price then
15pCV = pCV + 1
16end
17end)

2 answers

Log in to vote
3
Answered by
Damo999 182
10 years ago

Remove the end) at the top of you're script you only need those after you use an anonymous function also plr isn't defined so you need to do something like plr = game.Players.LocalPlayer make sure you put the script in a local script. The code should look like this

I would help more but i am not sure how you have everything set up so this is as much as i can do

01-- you're script i just indented this
02local cV = Instance.new("IntValue")
03cV.Name = "clickedValue"
04cV.Parent = plr.PlayerGui
05cV.Value = 1
06end)
07 
08script.Parent.MouseClick:connect(function(plr)
09    local pCV = plr:FindFirstChild("clickedValue")
10    local pLS = plr:FindFirstChild("leaderstats")
11    local pP = pLS:FindFirstChild("Points")
12    local price = 10
13    if pP < price then
14        pCV = pCV + 1
15    end
16end)
01--edited script
02local cV = Instance.new("IntValue")
03cV.Name = "clickedValue"
04plr = game.Players.LocalPlayer
05cV.Parent = plr.PlayerGui
06cV.Value = 1
07 
08script.Parent.MouseClick:connect(function(plr)
09    local pCV = plr:FindFirstChild("clickedValue")
10    local pLS = plr:FindFirstChild("leaderstats")
11    local pP = pLS:FindFirstChild("Points")
12    local price = 10
13    if pP < price then
14        pCV = pCV + 1
15    end
16end)
0
Correct, the player has to be defined for the top area, although in the MouseClick function, plr is a correct parameter. RaverKiller 668 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Remove the end)

You didn't start a function so it doesn't need an end. This would do it:

01local cV = Instance.new("IntValue")
02cV.Name = "clickedValue"
03cV.Parent = plr.PlayerGui
04cV.Value = 1    
05 
06script.Parent.MouseClick:connect(function(plr)
07local pCV = plr:FindFirstChild("clickedValue")
08local pLS = plr:FindFirstChild("leaderstats")
09local pP = pLS:FindFirstChild("Points")
10local price = 10
11 
12if pP < price then
13pCV = pCV + 1
14end
15end)

Answer this question