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

How do i fix this script?

Asked by 10 years ago

local l = script.Parent.Parent.Parent.Parent.Parent.leaderstats

function Click(mouse) if l.Knockouts.Value >= 5 then print"SUCCESS HAHA!" else script.Parent:remove() end end script.Parent.MouseButton1Down:connect(Click)

i don't know what i did wrong. can anyone help?

1 answer

Log in to vote
0
Answered by 10 years ago

Putting in a code block for readability. (remember, highlight your code then click the Lua symbol to make code more readible.

local l = script.Parent.Parent.Parent.Parent.Parent.leaderstats

function Click(mouse) 
    if l.Knockouts.Value >= 5 then 
        print"SUCCESS HAHA!"  -- change print"SUCCESS HAHA!" to print("SUCCESS HAHA!")
    else 
        script.Parent:remove() 
    end 
end 

script.Parent.MouseButton1Down:connect(Click)

Assuming that l actually leads to something then your code is almost fine other than your print. you put in print"Success Haha!" when the correct terminology is print("Success Haha!"), you need the brackets.

0
"local l = script.Parent.Parent.Parent.Parent.Parent.leaderstats" fireboltofdeath 635 — 10y
0
but that could have been a problem, having that many parents can be confusing and he might have overshot/undershot the leaderstats crackabottle123 110 — 10y
Ad

Answer this question