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

What is wrong with my script?

Asked by 9 years ago

EDIT : The main problem is that the cash.Value (local cash = stats:findFirstChild("Candy") --Get money) gives nil value. The problem with this is that I do have a leaderstat with the Candy as the currency.

What happens is my script passes by the print("Cat") and print("Dog") commands but then it does not pass print("Mow"). I do believe it has something to do with the cash value, correct me if i'm wrong. I have no errors when this happens. Any help?

01local ting = 0 --debouncer
02 
03function onClick(mouse)
04print("Hi")
05    if ting == 0 then --debounce check
06    ting = 1 --activate debounce
07    check = mouse.Parent:FindFirstChild("Humanoid") --Find the human that touched the button
08    print("Hillo")
09 
10    if check == nil then --If a human is found, then
11        print("Hullo")
12 
13        local user = game.Players:GetPlayerFromCharacter(mouse.Parent) --get player from touching human
14        print("Here")
15        local stats = game.Workspace:findFirstChild("leaderstats") --Find moneyholder
View all 35 lines...

Thanks.

0
There has to be an output error for this script. funyun 958 — 9y
0
08:01:03.190 - Workspace.Halloween kit.Clickswitch.Script:27: attempt to index local 'cash' (a nil value). It turns out I do have errors, they were just hiding with some of the dialog I told the script to do. Skepticlemon 24 — 9y
0
Can you post your entire script, the code you provided is not enough for us to help you. Bman8765 270 — 9y
0
Edit your question funyun 958 — 9y
View all comments (2 more)
0
There. Skepticlemon 24 — 9y
0
So, does anybody know how to fix this? Skepticlemon 24 — 9y

Answer this question