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

It says Attempted to call number value on line 9. Can someone help?

It keeps saying "Attempted to call a number value on line 9"

local Block = script.Parent

script.Parent.ClickDetector.MouseClick:Connect(function()
	wait(2)
	local Block = Instance.new("Part", game.Workspace.Block)
	script.Parent.Transparency = 0.6
	script.Parent.Anchored = false
	script.Parent.CanCollide = true
	if  (Block.Transparency = 0.6) then
		wait(2)
		game.Workspace.Block:Destroy()
	end
end)

Can someone fix this?

2 answers

You put one equal sign (which sets a value) instead of 2 equal signs (which determines the value)

local Block = script.Parent

script.Parent.ClickDetector.MouseClick:Connect(function()
    wait(2)
    local Block = Instance.new("Part", game.Workspace.Block)
    script.Parent.Transparency = 0.6
    script.Parent.Anchored = false
    script.Parent.CanCollide = true
    if  (Block.Transparency == 0.6) then
        wait(2)
        game.Workspace.Block:Destroy()
    end
end)

as @Geobloxia said, you need two equal signs. For conditional statements, you need to use ==, >, >=, <, <=, or ~=. Read more about conditional statements Here

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