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

How do i fix this script?

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

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.

2 comments

0

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

0

but that could have been a problem, having that many parents can be confusing and he might have overshot/undershot the leaderstats

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