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

what is wrong with this? it seems as if there is nothing wrong

local Enabled = Active local player = game.Players.LocalPlayer

local NykoID = 123585026 local SethID = 55137798

if script.Parent.Parent.Parent.Parent.UserId == NykoID or SethID then script.Parent.Visible = true script.Parent.Enabled = true else script.Parent.Visible = false script.Parent.Enabled = false script.Parent.Parent:Destroy() end

if function leftClick() then script.Parent.Console.Visible = true else script.Parent.Console.Visible = true end

script.Parent.MouseButton1Click:Connect(leftClick)

something is wrong and i have no idea what it is, can someone help?

1 answer

One thing I see that is wrong is that when using or, you'll need a full condition on the other side. In this particular situation you put if script.Parent.Parent.Parent.Parent.UserId == NykoID or SethID and on the other side of the or SethID is not a full condition. To fix this replace if script.Parent.Parent.Parent.Parent.UserId == NykoID or SethID to

local Enabled = Active 
local player = game.Players.LocalPlayer

local NykoID = 123585026 
local SethID = 55137798

if script.Parent.Parent.Parent.Parent.UserId == NykoID or script.Parent.Parent.Parent.Parent.UserId == SethID then 
	script.Parent.Visible = true
	script.Parent.Enabled = true 
else 
	script.Parent.Visible = false 
	script.Parent.Enabled = false 
	script.Parent.Parent:Destroy() 
end

function leftClick()
	script.Parent.Console.Visible = true 
end

script.Parent.MouseButton1Click:Connect(leftClick)

Another problem was that when you connected the function, what happens is roblox tries to run the function but can't because you did something weird there. I replaced the if statement to the function name you desired so when someone left clicks the function runs.

I hope this helped. (edit was to make the code look better)

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